Guest User

Untitled

a guest
Feb 20th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. describe "when logging in at '/'" do
  2. describe "the login form" do
  3. it "exists" do
  4. response_for("/").should have_xpath("//*")
  5. end
  6.  
  7. it "POSTS to url(:login)" do
  8. response_for("/").should have_xpath("//form[@method='post'][@action='#{url(:login)}']")
  9. end
  10.  
  11. it "has a text field named 'username'" do
  12. response_for("/").should have_xpath("//form/input[@name='username'][@type='text']")
  13. end
  14.  
  15. it "has a password field named password" do
  16. response_for("/").should have_xpath("//form/input[@name='password'][@type='password']")
  17. end
  18. end
  19.  
  20. it "redirects to '/' if the login was incorrect" do
  21. requesting("/", :method => "POST",
  22. :body_params => {:username => "wycats", :password => "bad"}).
  23. should redirect_to(:get_login)
  24. end
  25.  
  26. it "logs in" do
  27. logging_in.should redirect_to(:home)
  28. end
  29. end
Add Comment
Please, Sign In to add comment