Commit 49fdb7f3 authored by Thong Kuah's avatar Thong Kuah

Remove usages of pipeline.environments in specs

This pipeline.environments association creates cross-db queries, so
should be removed eventually
parent da5542a6
...@@ -3524,7 +3524,7 @@ RSpec.describe MergeRequest, factory_default: :keep do ...@@ -3524,7 +3524,7 @@ RSpec.describe MergeRequest, factory_default: :keep do
let!(:job) { create(:ci_build, :with_deployment, :start_review_app, pipeline: pipeline, project: project) } let!(:job) { create(:ci_build, :with_deployment, :start_review_app, pipeline: pipeline, project: project) }
it 'returns environments' do it 'returns environments' do
is_expected.to eq(pipeline.environments) is_expected.to eq(pipeline.environments_in_self_and_descendants.to_a)
expect(subject.count).to be(1) expect(subject.count).to be(1)
end end
......
...@@ -185,7 +185,7 @@ RSpec.describe Environments::StopService do ...@@ -185,7 +185,7 @@ RSpec.describe Environments::StopService do
end end
it 'has active environment at first' do it 'has active environment at first' do
expect(pipeline.environments.first).to be_available expect(pipeline.environments_in_self_and_descendants.first).to be_available
end end
context 'when user is a developer' do context 'when user is a developer' do
...@@ -196,7 +196,7 @@ RSpec.describe Environments::StopService do ...@@ -196,7 +196,7 @@ RSpec.describe Environments::StopService do
it 'stops the active environment' do it 'stops the active environment' do
subject subject
expect(pipeline.environments.first).to be_stopped expect(pipeline.environments_in_self_and_descendants.first).to be_stopped
end end
end end
...@@ -208,7 +208,7 @@ RSpec.describe Environments::StopService do ...@@ -208,7 +208,7 @@ RSpec.describe Environments::StopService do
it 'does not stop the active environment' do it 'does not stop the active environment' do
subject subject
expect(pipeline.environments.first).to be_available expect(pipeline.environments_in_self_and_descendants.first).to be_available
end end
end end
...@@ -232,7 +232,7 @@ RSpec.describe Environments::StopService do ...@@ -232,7 +232,7 @@ RSpec.describe Environments::StopService do
it 'does not stop the active environment' do it 'does not stop the active environment' do
subject subject
expect(pipeline.environments.first).to be_available expect(pipeline.environments_in_self_and_descendants.first).to be_available
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment