diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-05 12:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-05 12:09:10 +0300 |
commit | 187727e24865494570a0d0e162a9f44e721aacde (patch) | |
tree | dc0467d2ed463e7339f6873f9a23844bb70b79e5 /spec/models | |
parent | b4d76c5ac78ec9f690e2094fbf5f77331b9432c8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/bulk_imports/entity_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/concerns/mentionable_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/concerns/prometheus_adapter_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/environment_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/integrations/prometheus_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 26 |
6 files changed, 33 insertions, 21 deletions
diff --git a/spec/models/bulk_imports/entity_spec.rb b/spec/models/bulk_imports/entity_spec.rb index fab32af5bd4..f4f2b174a7b 100644 --- a/spec/models/bulk_imports/entity_spec.rb +++ b/spec/models/bulk_imports/entity_spec.rb @@ -151,6 +151,18 @@ RSpec.describe BulkImports::Entity, type: :model do expect(entity).to be_valid end end + + context 'when bulk_import_projects feature flag is enabled on root ancestor level and source_type is a project_entity' do + it 'is valid' do + top_level_namespace = create(:group) + + stub_feature_flags(bulk_import_projects: top_level_namespace) + + entity = build(:bulk_import_entity, :project_entity, destination_namespace: top_level_namespace.full_path) + + expect(entity).to be_valid + end + end end describe '#encoded_source_full_path' do diff --git a/spec/models/concerns/mentionable_spec.rb b/spec/models/concerns/mentionable_spec.rb index 9daea3438cb..7bbbd10ec8d 100644 --- a/spec/models/concerns/mentionable_spec.rb +++ b/spec/models/concerns/mentionable_spec.rb @@ -225,7 +225,7 @@ RSpec.describe Commit, 'Mentionable' do end context 'with external issue tracker' do - let(:project) { create(:jira_project, :repository) } + let(:project) { create(:project, :with_jira_integration, :repository) } it 'is true if external issues referenced' do allow(commit.raw).to receive(:message).and_return 'JIRA-123' diff --git a/spec/models/concerns/prometheus_adapter_spec.rb b/spec/models/concerns/prometheus_adapter_spec.rb index 4158e8a0a4c..d3a44ac8403 100644 --- a/spec/models/concerns/prometheus_adapter_spec.rb +++ b/spec/models/concerns/prometheus_adapter_spec.rb @@ -6,7 +6,7 @@ RSpec.describe PrometheusAdapter, :use_clean_rails_memory_store_caching do include PrometheusHelpers include ReactiveCachingHelpers - let(:project) { create(:prometheus_project) } + let(:project) { create(:project, :with_prometheus_integration) } let(:integration) { project.prometheus_integration } let(:described_class) do diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 1e15b09a069..3e1812aac9d 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -1291,7 +1291,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do context 'when the environment is available' do context 'with a deployment service' do - let(:project) { create(:prometheus_project, :repository) } + let(:project) { create(:project, :with_prometheus_integration, :repository) } context 'and a deployment' do let!(:deployment) { create(:deployment, environment: environment) } @@ -1364,7 +1364,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do end context 'when the environment is unavailable' do - let(:project) { create(:prometheus_project) } + let(:project) { create(:project, :with_prometheus_integration) } before do environment.stop @@ -1391,7 +1391,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do end describe '#metrics' do - let(:project) { create(:prometheus_project) } + let(:project) { create(:project, :with_prometheus_integration) } subject { environment.metrics } @@ -1427,7 +1427,7 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching do end describe '#additional_metrics' do - let(:project) { create(:prometheus_project) } + let(:project) { create(:project, :with_prometheus_integration) } let(:metric_params) { [] } subject { environment.additional_metrics(*metric_params) } diff --git a/spec/models/integrations/prometheus_spec.rb b/spec/models/integrations/prometheus_spec.rb index ae965ed78d1..3971511872b 100644 --- a/spec/models/integrations/prometheus_spec.rb +++ b/spec/models/integrations/prometheus_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Integrations::Prometheus, :use_clean_rails_memory_store_caching, include PrometheusHelpers include ReactiveCachingHelpers - let_it_be_with_reload(:project) { create(:prometheus_project) } + let_it_be_with_reload(:project) { create(:project, :with_prometheus_integration) } let(:integration) { project.prometheus_integration } @@ -318,7 +318,7 @@ RSpec.describe Integrations::Prometheus, :use_clean_rails_memory_store_caching, context 'cluster belongs to projects group' do let_it_be(:group) { create(:group) } - let(:project) { create(:prometheus_project, group: group) } + let(:project) { create(:project, :with_prometheus_integration, group: group) } let(:cluster) { create(:cluster_for_group, groups: [group]) } it 'returns true' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index bac76fbabca..4850dd92a7e 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1415,7 +1415,7 @@ RSpec.describe Project, factory_default: :keep do it "is false if used other tracker" do # NOTE: The current nature of this factory requires persistence - project = create(:redmine_project) + project = create(:project, :with_redmine_integration) expect(project.default_issues_tracker?).to be_falsey end @@ -1460,7 +1460,7 @@ RSpec.describe Project, factory_default: :keep do describe '#external_issue_tracker' do it 'sets Project#has_external_issue_tracker when it is nil' do project_with_no_tracker = create(:project, has_external_issue_tracker: nil) - project_with_tracker = create(:redmine_project, has_external_issue_tracker: nil) + project_with_tracker = create(:project, :with_redmine_integration, has_external_issue_tracker: nil) expect do project_with_no_tracker.external_issue_tracker @@ -1479,7 +1479,7 @@ RSpec.describe Project, factory_default: :keep do end it 'retrieves external_issue_tracker querying services and cache it when there is external issue tracker' do - project = create(:redmine_project) + project = create(:project, :with_redmine_integration) expect(project).to receive(:integrations).once.and_call_original 2.times { expect(project.external_issue_tracker).to be_a_kind_of(Integrations::Redmine) } @@ -5750,40 +5750,40 @@ RSpec.describe Project, factory_default: :keep do describe '#has_active_hooks?' do let_it_be_with_refind(:project) { create(:project) } - it { expect(project.has_active_hooks?).to be_falsey } + it { expect(project.has_active_hooks?).to eq(false) } it 'returns true when a matching push hook exists' do create(:project_hook, push_events: true, project: project) - expect(project.has_active_hooks?(:merge_request_events)).to be_falsey - expect(project.has_active_hooks?).to be_truthy + expect(project.has_active_hooks?(:merge_request_hooks)).to eq(false) + expect(project.has_active_hooks?).to eq(true) end it 'returns true when a matching system hook exists' do create(:system_hook, push_events: true) - expect(project.has_active_hooks?(:merge_request_events)).to be_falsey - expect(project.has_active_hooks?).to be_truthy + expect(project.has_active_hooks?(:merge_request_hooks)).to eq(false) + expect(project.has_active_hooks?).to eq(true) end it 'returns true when a plugin exists' do expect(Gitlab::FileHook).to receive(:any?).twice.and_return(true) - expect(project.has_active_hooks?(:merge_request_events)).to be_truthy - expect(project.has_active_hooks?).to be_truthy + expect(project.has_active_hooks?(:merge_request_hooks)).to eq(true) + expect(project.has_active_hooks?).to eq(true) end end describe '#has_active_integrations?' do let_it_be(:project) { create(:project) } - it { expect(project.has_active_integrations?).to be_falsey } + it { expect(project.has_active_integrations?).to eq(false) } it 'returns true when a matching service exists' do create(:custom_issue_tracker_integration, push_events: true, merge_requests_events: false, project: project) - expect(project.has_active_integrations?(:merge_request_hooks)).to be_falsey - expect(project.has_active_integrations?).to be_truthy + expect(project.has_active_integrations?(:merge_request_hooks)).to eq(false) + expect(project.has_active_integrations?).to eq(true) end end |