spec/controllers/admin/preferences_controller_spec.rb in radiant-0.8.2 vs spec/controllers/admin/preferences_controller_spec.rb in radiant-0.9.0.rc2

- old
+ new

@@ -15,18 +15,17 @@ it "should allow you to save your preferences" do login_as :non_admin put :update, :user => { :password => '', :password_confirmation => '', :email => 'updated@gmail.com' } user = users(:non_admin) - response.should redirect_to(admin_pages_path) - flash[:notice].should match(/preferences.*?updated/i) + response.should redirect_to(admin_preferences_path) user.email.should == 'updated@gmail.com' end - it "should not allow you to update your login through the preferences page" do + it "should not allow you to update your role through the preferences page" do login_as :non_admin - put :update, 'user' => { :login => 'superman' } + put :update, 'user' => { :admin => true } response.should be_success flash[:error].should match(/bad form data/i) end it "should allow you to change your password" do @@ -34,11 +33,11 @@ put :update, { :user => { :password => 'funtimes', :password_confirmation => 'funtimes' } } user = users(:non_admin) user.password.should == user.sha1('funtimes') end - it "should use the User.protected_attributes for checking valid_params?" do - User.should_receive(:protected_attributes).at_least(:once).and_return([:password, :password_confirmation, :email]) + it "should use the User.unprotected_attributes for checking valid_params?" do + User.should_receive(:unprotected_attributes).at_least(:once).and_return([:password, :password_confirmation, :email]) login_as :non_admin put :update, { :user => { :password => 'funtimes', :password_confirmation => 'funtimes' } } end end