Guest User

Untitled

a guest
Sep 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. # Actually, the steps for the above test are spread throughout more pertinently-names step files.
  2. # For convenience sake, I added a bunch of sample steps here.
  3.  
  4. When /^I login as "([^"]*)"( and "([^"]*)")?$/ do |login, stuff, pw|
  5. @login_name = login
  6. password = pw
  7. user = Account.where(:login => login).first
  8. password = user.password if user and pw.blank?
  9. visit login_path
  10. fill_in "login", :with => login
  11. fill_in "password", :with => password
  12. click_button "login_button"
  13. end
  14.  
  15.  
  16. And /^I should be able to click on "([^"]*)" and see "([^"]*)"$/ do |link, expected|
  17. click_link link
  18. response.should contain expected
  19. end
  20.  
  21.  
  22. Then /^(?:|I )should see "([^"]*)"$/ do |text|
  23. if response.respond_to? :should
  24. response.should contain(text)
  25. else
  26. assert_contain text
  27. end
  28. end
  29.  
  30. And /^I click on "([^"]*)"$/ do |link|
  31. click_link link
  32. end
  33.  
  34. When /^I search for "([^"]*)"$/ do |search_term|
  35. fill_in :search_field, :with => search_term
  36. click_button "search"
  37. end
  38.  
  39. Then /^I should be able to see "([^"]*)"$/ do |expected|
  40. response.should contain expected
  41. end
  42.  
  43. When /^I search by "([^"]*)" for "([^"]*)"$/ do |search_type, search_term|
  44. fill_in search_type, :with => search_term
  45. click_button "search"
  46. end
Add Comment
Please, Sign In to add comment