diff options
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/bridge_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/commit_status_spec.rb | 9 | ||||
-rw-r--r-- | spec/models/environment_spec.rb | 11 | ||||
-rw-r--r-- | spec/models/namespace_spec.rb | 8 |
4 files changed, 18 insertions, 14 deletions
diff --git a/spec/models/ci/bridge_spec.rb b/spec/models/ci/bridge_spec.rb index 49b32c6f6b8..ac994735928 100644 --- a/spec/models/ci/bridge_spec.rb +++ b/spec/models/ci/bridge_spec.rb @@ -160,7 +160,9 @@ RSpec.describe Ci::Bridge, feature_category: :continuous_integration do where(:downstream_status, :upstream_status) do [ %w[success success], - *::Ci::Pipeline.completed_statuses.without(:success).map { |status| [status.to_s, 'failed'] } + %w[canceled canceled], + %w[failed failed], + %w[skipped failed] ] end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index d033d4adba7..38c45e8c975 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -565,6 +565,15 @@ RSpec.describe CommitStatus, feature_category: :continuous_integration do end end + describe '.with_type' do + let_it_be(:build_job) { create_status(name: 'build job', type: ::Ci::Build) } + let_it_be(:bridge_job) { create_status(name: 'bridge job', type: ::Ci::Bridge) } + + it 'returns statuses that match type' do + expect(described_class.with_type(::Ci::Build)).to contain_exactly(have_attributes(name: 'build job')) + end + end + describe '#before_sha' do subject { commit_status.before_sha } diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index d62d7162497..87beba680d8 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -2009,10 +2009,9 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching, feature_categ end end - describe '#deploy_freezes', :request_store do + describe '#deploy_freezes' do let(:environment) { create(:environment, project: project, name: 'staging') } let(:freeze_period) { create(:ci_freeze_period, project: project) } - let(:cache_key) { "project:#{project.id}:freeze_periods_for_environments" } subject { environment.deploy_freezes } @@ -2021,9 +2020,11 @@ RSpec.describe Environment, :use_clean_rails_memory_store_caching, feature_categ end it 'caches the freeze periods' do - expect { subject }.to( - change { Gitlab::SafeRequestStore[cache_key] }.from(nil).to([freeze_period]) - ) + expect(Gitlab::SafeRequestStore).to receive(:fetch) + .at_least(:once) + .and_return([freeze_period]) + + subject end end diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index d628812e081..3ff49938de5 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -1733,14 +1733,6 @@ RSpec.describe Namespace, feature_category: :subgroups do end describe '#all_projects' do - context 'when recursive approach is disabled' do - before do - stub_feature_flags(recursive_approach_for_all_projects: false) - end - - include_examples '#all_projects' - end - context 'with use_traversal_ids feature flag enabled' do before do stub_feature_flags(use_traversal_ids: true) |