unify user notifications for permission/level changes #2470

This commit is contained in:
r888888888
2015-10-27 11:11:32 -07:00
parent 010008eab3
commit b695a7980f
3 changed files with 30 additions and 69 deletions

View File

@@ -76,25 +76,11 @@ class UsersControllerTest < ActionController::TestCase
@cuser = FactoryGirl.create(:user)
end
should "not work if the current user is not an admin" do
should "not work" do
post :update, {:id => @user.id, :user => {:level => 40}}, {:user_id => @cuser.id}
@user.reload
assert_equal(20, @user.level)
end
context "where the current user is an admin" do
setup do
@admin = FactoryGirl.create(:admin_user)
end
should "create a user feedback" do
assert_difference("UserFeedback.count") do
post :update, {:id => @user.id, :user => {:level => 40}}, {:user_id => @admin.id}
end
@user.reload
assert_equal(40, @user.level)
end
end
end
end
end