Improve specs related to CI/CD job environment
This commit is contained in:
parent
c3af43c3d2
commit
ee592f0df3
1 changed files with 12 additions and 8 deletions
|
@ -902,22 +902,26 @@ describe Ci::Build, :models do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#persisted_environment' do
|
describe '#persisted_environment' do
|
||||||
before do
|
let!(:environment) do
|
||||||
@environment = create(:environment, project: project, name: "foo-#{project.default_branch}")
|
create(:environment, project: project, name: "foo-#{project.default_branch}")
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { build.persisted_environment }
|
subject { build.persisted_environment }
|
||||||
|
|
||||||
context 'referenced literally' do
|
context 'when referenced literally' do
|
||||||
let(:build) { create(:ci_build, pipeline: pipeline, environment: "foo-#{project.default_branch}") }
|
let(:build) do
|
||||||
|
create(:ci_build, pipeline: pipeline, environment: "foo-#{project.default_branch}")
|
||||||
it { is_expected.to eq(@environment) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'referenced with a variable' do
|
it { is_expected.to eq(environment) }
|
||||||
let(:build) { create(:ci_build, pipeline: pipeline, environment: "foo-$CI_COMMIT_REF_NAME") }
|
end
|
||||||
|
|
||||||
it { is_expected.to eq(@environment) }
|
context 'when referenced with a variable' do
|
||||||
|
let(:build) do
|
||||||
|
create(:ci_build, pipeline: pipeline, environment: "foo-$CI_COMMIT_REF_NAME")
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to eq(environment) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue