diff options
author | Markus Koller <markus-koller@gmx.ch> | 2017-09-28 16:49:42 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-28 16:49:42 +0000 |
commit | e9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489 (patch) | |
tree | d2402a99dd96927ae458f49cbd7de8ad043e297a /spec/finders | |
parent | 93a33556e3e01a83c1af9c21e11ff433b624c40d (diff) | |
download | gitlab-ce-e9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489.tar.gz |
Support custom attributes on users
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/users_finder_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/finders/users_finder_spec.rb b/spec/finders/users_finder_spec.rb index 1bab6d64388..4249c52c481 100644 --- a/spec/finders/users_finder_spec.rb +++ b/spec/finders/users_finder_spec.rb @@ -56,6 +56,15 @@ describe UsersFinder do expect(users.map(&:username)).not_to include([filtered_user_before.username, filtered_user_after.username]) end + + it 'does not filter by custom attributes' do + users = described_class.new( + user, + custom_attributes: { foo: 'bar' } + ).execute + + expect(users).to contain_exactly(user, user1, user2, omniauth_user) + end end context 'with an admin user' do @@ -72,6 +81,19 @@ describe UsersFinder do expect(users).to contain_exactly(admin, user1, user2, external_user, omniauth_user) end + + it 'filters by custom attributes' do + create :user_custom_attribute, user: user1, key: 'foo', value: 'foo' + create :user_custom_attribute, user: user1, key: 'bar', value: 'bar' + create :user_custom_attribute, user: user2, key: 'foo', value: 'foo' + + users = described_class.new( + admin, + custom_attributes: { foo: 'foo', bar: 'bar' } + ).execute + + expect(users).to contain_exactly(user1) + end end end end |