diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 00:10:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 00:10:48 +0300 |
commit | b9a2e3f2cc581cb8bd40f8273a13cd4c9daf59b5 (patch) | |
tree | 9dd9a2f54b5bc5a4816a1cb8e44f84b534e6597c /spec | |
parent | 57f6fa3cd786acb4ead4b7a2d3aa43b6c7abbc58 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/data_builder/build_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/data_builder/pipeline_spec.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/data_builder/build_spec.rb b/spec/lib/gitlab/data_builder/build_spec.rb index 4242469b3db..ab1728414bb 100644 --- a/spec/lib/gitlab/data_builder/build_spec.rb +++ b/spec/lib/gitlab/data_builder/build_spec.rb @@ -38,6 +38,7 @@ RSpec.describe Gitlab::DataBuilder::Build do it { expect(data[:runner][:id]).to eq(build.runner.id) } it { expect(data[:runner][:tags]).to match_array(tag_names) } it { expect(data[:runner][:description]).to eq(build.runner.description) } + it { expect(data[:environment]).to be_nil } context 'commit author_url' do context 'when no commit present' do @@ -63,6 +64,13 @@ RSpec.describe Gitlab::DataBuilder::Build do expect(data[:commit][:author_url]).to eq(Gitlab::Routing.url_helpers.user_url(username: build.commit.author.username)) end end + + context 'with environment' do + let(:build) { create(:ci_build, :teardown_environment) } + + it { expect(data[:environment][:name]).to eq(build.expanded_environment_name) } + it { expect(data[:environment][:action]).to eq(build.environment_action) } + end end end end diff --git a/spec/lib/gitlab/data_builder/pipeline_spec.rb b/spec/lib/gitlab/data_builder/pipeline_spec.rb index fd7cadeb89e..cf04f560ceb 100644 --- a/spec/lib/gitlab/data_builder/pipeline_spec.rb +++ b/spec/lib/gitlab/data_builder/pipeline_spec.rb @@ -37,6 +37,7 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do expect(build_data[:id]).to eq(build.id) expect(build_data[:status]).to eq(build.status) expect(build_data[:allow_failure]).to eq(build.allow_failure) + expect(build_data[:environment]).to be_nil expect(runner_data).to eq(nil) expect(project_data).to eq(project.hook_attrs(backward: false)) expect(data[:merge_request]).to be_nil @@ -115,5 +116,12 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do expect(build_data[:id]).to eq(build.id) end end + + context 'build with environment' do + let!(:build) { create(:ci_build, :teardown_environment, pipeline: pipeline) } + + it { expect(build_data[:environment][:name]).to eq(build.expanded_environment_name) } + it { expect(build_data[:environment][:action]).to eq(build.environment_action) } + end end end |