Guest User

Untitled

a guest
Mar 3rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. Given /^I am a registered user with login "([^"]+)" and password "([^"]+)"$/ do |login, password|
  2. @login = login
  3. @password = password
  4. @current_user = Factory(:user, :email => "#{@login}@example.com", :login => @login, :password => @password, :password_confirmation => @password)
  5. end
  6.  
  7. Given /^I am logged in as a registered user$/ do
  8. @login = "shyguy"
  9. @password = "test"
  10. @current_user = Factory(:user, :email => "#{@login}@example.com", :login => @login, :password => @password, :password_confirmation => @password)
  11. Given "I log in"
  12. end
  13.  
  14. Given /^I am not a registered user$/ do
  15. end
  16.  
  17. Given /^I log in$/ do
  18. visit login_path
  19. When %{I fill in "login" with "#{@login}"}
  20. When %{I fill in "password" with "#{@password}"}
  21. When %{I press "Go"}
  22. Then %{I should see "Logged in successfully"}
  23. end
  24.  
  25. Given /^I am not logged in$/ do
  26. end
  27.  
  28. Then /^I should be prompted to login$/ do
  29. response.should contain("You must login to access that part of the site")
  30. end
Add Comment
Please, Sign In to add comment