Guest User

Untitled

a guest
Jun 25th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/acceptance_helper'
  2.  
  3. feature "Login", %q{
  4. In order to be able to use the application
  5. As a user
  6. I want to be able to login
  7. } do
  8.  
  9. background do
  10. Factory(:user, :login => 'default', :name => 'Default')
  11. end
  12.  
  13. scenario "Login required" do
  14. visit homepage
  15. page.should have_content("You need to sign in or sign up before continuing.")
  16. end
  17.  
  18. scenario "Login sucessfully" do
  19. logged_in_as_default
  20. page.should have_content("Signed in successfully.") and page.should have_content("Logged in as default")
  21. current_path.should == homepage
  22. end
  23.  
  24. scenario "Login failed" do
  25. visit login_path
  26. fill_in("Login", :with => "default")
  27. fill_in("Password", :with => "654321")
  28. click_button("Login")
  29. page.should have_content("Invalid login or password.")
  30. current_path.should == login_path
  31. end
  32.  
  33. scenario "Logout" do
  34. logged_in_as_default
  35. click("Logout")
  36. current_path.should == login_path
  37. end
  38.  
  39. end
Add Comment
Please, Sign In to add comment