Advertisement
Guest User

Untitled

a guest
Jul 31st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. context "Adding a user with an existing username" do
  2. fixtures :users, :roles, :rights
  3. controller_name :account
  4.  
  5. setup do
  6. roles(:admin).rights << rights(:admin)
  7. users(:rod).roles << roles(:admin)
  8. @session[:user] = users('rod').id
  9. post 'add_user', :realname => 'Another Rod', :username => 'rod', :password => 'mcmahon', :password_confirmation => 'mcmahon'
  10. end
  11.  
  12. specify "should not create a new user" do
  13. User.should_not_exist :realname => 'Another Rod'
  14. end
  15.  
  16. specify "should show errors" do
  17. response.should_have_rjs :effect, :blind_down, 'errors'
  18. end
  19.  
  20. specify "should show a duplicate username error" do
  21. response.should_have_rjs :replace_html, 'errors', /Username has already been taken/
  22. end
  23.  
  24. specify "should not update the user list" do
  25. response.should_not_have_rjs :replace_html, 'userData'
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement