Skip to content

Commit

Permalink
added rspec to check that use.currentuser is not updated if user is s…
Browse files Browse the repository at this point in the history
…uperadmin
  • Loading branch information
yrudman committed Apr 26, 2018
1 parent d7a37e8 commit 1baf52a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/lib/rbac/filterer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,14 @@ def get_rbac_results_for_and_expect_objects(klass, expected_objects)
_, group = filter.send(:lookup_user_group, admin, nil, nil, random_group.id)
expect(group).to eq(random_group)
end

it "does not update user.current_group if user is super admin" do
admin = FactoryGirl.create(:user_admin)
admin_group = admin.current_group
random_group = FactoryGirl.create(:miq_group)
_, group = filter.send(:lookup_user_group, admin, nil, nil, random_group.id)
expect(admin.current_group).to eq(admin_group)
end
end

context "user" do
Expand Down

0 comments on commit 1baf52a

Please sign in to comment.