Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/feature_spec.rb')
-rw-r--r--spec/lib/feature_spec.rb48
1 files changed, 42 insertions, 6 deletions
diff --git a/spec/lib/feature_spec.rb b/spec/lib/feature_spec.rb
index 56e0b4bca30..ad324406450 100644
--- a/spec/lib/feature_spec.rb
+++ b/spec/lib/feature_spec.rb
@@ -522,7 +522,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable }
- let(:expected_extra) { { "extra.thing" => "#{thing.flipper_id}" } }
+ let(:expected_extra) { { "extra.thing" => thing.flipper_id.to_s } }
end
end
end
@@ -548,7 +548,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :disable }
- let(:expected_extra) { { "extra.thing" => "#{thing.flipper_id}" } }
+ let(:expected_extra) { { "extra.thing" => thing.flipper_id.to_s } }
end
end
end
@@ -561,7 +561,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable_percentage_of_time }
- let(:expected_extra) { { "extra.percentage" => "#{percentage}" } }
+ let(:expected_extra) { { "extra.percentage" => percentage.to_s } }
end
end
@@ -584,7 +584,7 @@ RSpec.describe Feature, stub_feature_flags: false do
it_behaves_like 'logging' do
let(:expected_action) { :enable_percentage_of_actors }
- let(:expected_extra) { { "extra.percentage" => "#{percentage}" } }
+ let(:expected_extra) { { "extra.percentage" => percentage.to_s } }
end
end
@@ -790,11 +790,47 @@ RSpec.describe Feature, stub_feature_flags: false do
let(:group) { create(:group) }
let(:user_name) { project.first_owner.username }
- subject { described_class.new(user: user_name, project: project.full_path, group: group.full_path) }
+ subject do
+ described_class.new(
+ user: user_name,
+ project: project.full_path,
+ group: group.full_path,
+ repository: project.repository.full_path
+ )
+ end
it 'returns all found targets' do
expect(subject.targets).to be_an(Array)
- expect(subject.targets).to eq([project.first_owner, project, group])
+ expect(subject.targets).to eq([project.first_owner, project, group, project.repository])
+ end
+
+ context 'when repository target works with different types of repositories' do
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project) { create(:project, :wiki_repo, group: group) }
+ let_it_be(:project_in_user_namespace) { create(:project, namespace: create(:user).namespace) }
+ let(:personal_snippet) { create(:personal_snippet) }
+ let(:project_snippet) { create(:project_snippet, project: project) }
+
+ let(:targets) do
+ [
+ project,
+ project.wiki,
+ project_in_user_namespace,
+ personal_snippet,
+ project_snippet
+ ]
+ end
+
+ subject do
+ described_class.new(
+ repository: targets.map { |t| t.repository.full_path }.join(",")
+ )
+ end
+
+ it 'returns all found targets' do
+ expect(subject.targets).to be_an(Array)
+ expect(subject.targets).to eq(targets.map(&:repository))
+ end
end
end
end