summaryrefslogtreecommitdiff
path: root/spec/models/ci/pipeline_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r--spec/models/ci/pipeline_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 5f3aad0ab24..e573a6ef780 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -3361,7 +3361,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
shared_examples 'sending a notification' do
it 'sends an email', :sidekiq_might_not_need_inline do
- should_only_email(pipeline.user, kind: :bcc)
+ should_only_email(pipeline.user)
end
end
@@ -4595,4 +4595,20 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
end
end
end
+
+ describe '#authorized_cluster_agents' do
+ let(:pipeline) { create(:ci_empty_pipeline, :created) }
+ let(:agent) { instance_double(Clusters::Agent) }
+ let(:authorization) { instance_double(Clusters::Agents::GroupAuthorization, agent: agent) }
+ let(:finder) { double(execute: [authorization]) }
+
+ it 'retrieves agent records from the finder and caches the result' do
+ expect(Clusters::AgentAuthorizationsFinder).to receive(:new).once
+ .with(pipeline.project)
+ .and_return(finder)
+
+ expect(pipeline.authorized_cluster_agents).to contain_exactly(agent)
+ expect(pipeline.authorized_cluster_agents).to contain_exactly(agent) # cached
+ end
+ end
end