summaryrefslogtreecommitdiff
path: root/spec/models/operations/feature_flags/user_list_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/operations/feature_flags/user_list_spec.rb')
-rw-r--r--spec/models/operations/feature_flags/user_list_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/operations/feature_flags/user_list_spec.rb b/spec/models/operations/feature_flags/user_list_spec.rb
index 020416aa7bc..3a48d3389a3 100644
--- a/spec/models/operations/feature_flags/user_list_spec.rb
+++ b/spec/models/operations/feature_flags/user_list_spec.rb
@@ -92,6 +92,25 @@ RSpec.describe Operations::FeatureFlags::UserList do
end
end
+ describe '.for_name_like' do
+ let_it_be(:project) { create(:project) }
+ let_it_be(:user_list_one) { create(:operations_feature_flag_user_list, project: project, name: 'one') }
+ let_it_be(:user_list_two) { create(:operations_feature_flag_user_list, project: project, name: 'list_two') }
+ let_it_be(:user_list_three) { create(:operations_feature_flag_user_list, project: project, name: 'list_three') }
+
+ it 'returns a found name' do
+ lists = project.operations_feature_flags_user_lists.for_name_like('list')
+
+ expect(lists).to contain_exactly(user_list_two, user_list_three)
+ end
+
+ it 'returns an empty array when no lists match the query' do
+ lists = project.operations_feature_flags_user_lists.for_name_like('no match')
+
+ expect(lists).to be_empty
+ end
+ end
+
it_behaves_like 'AtomicInternalId' do
let(:internal_id_attribute) { :iid }
let(:instance) { build(:operations_feature_flag_user_list) }