Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context "Adding a user with an existing username" do
- fixtures :users, :roles, :rights
- controller_name :account
- setup do
- roles(:admin).rights << rights(:admin)
- users(:rod).roles << roles(:admin)
- @session[:user] = users('rod').id
- post 'add_user', :realname => 'Another Rod', :username => 'rod', :password => 'mcmahon', :password_confirmation => 'mcmahon'
- end
- specify "should not create a new user" do
- User.should_not_exist :realname => 'Another Rod'
- end
- specify "should show errors" do
- response.should_have_rjs :effect, :blind_down, 'errors'
- end
- specify "should show a duplicate username error" do
- response.should_have_rjs :replace_html, 'errors', /Username has already been taken/
- end
- specify "should not update the user list" do
- response.should_not_have_rjs :replace_html, 'userData'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement