Guest User

Untitled

a guest
May 19th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.53 KB | None | 0 0
  1. module LoginHelper
  2.    
  3.   # Login shortcut for request specs
  4.   def login(user, check_page=true)
  5.     visit root_path
  6.     fill_in "Email", with: user.email
  7.     fill_in "Password", with: user.password
  8.     click_button "Log in"
  9.     current_path.should eq(dashboard_path) if check_page
  10.     #page.should have_no_content("Invalid")
  11.   end
  12.  
  13.   # A shortcut for logging out inside request specs
  14.   def logout
  15.     if page.has_link?("Log out")
  16.       click_link "Log out"
  17.       #page.should have_content('Logged out!')
  18.     end
  19.   end
  20. end
Add Comment
Please, Sign In to add comment