diff options
author | Nick Thomas <nick@gitlab.com> | 2016-12-08 15:37:41 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-12-15 13:57:04 +0000 |
commit | 58486918fc12bbcc5139b6ca32461ad5e037497b (patch) | |
tree | 45f046807b9c15612acd66f0790662178b1e8fed /spec | |
parent | 93a03cd92f6418fbeaf126c30c161ab40d377e94 (diff) | |
download | gitlab-ce-58486918fc12bbcc5139b6ca32461ad5e037497b.tar.gz |
Create environments when the build referencing them is created
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/environment_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/ci/create_pipeline_service_spec.rb | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 706f1a5cd1c..97cbb093ed2 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -223,7 +223,7 @@ describe Environment, models: true do "foo-" => "foo" + SUFFIX, }.each do |name, matcher| it "returns a slug matching #{matcher}, given #{name}" do - slug = described_class.new(name: name).generate_clean_name + slug = described_class.new(name: name).generate_slug expect(slug).to match(/\A#{matcher}\z/) end diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 4aadd009f3e..ceaca96e25b 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -210,5 +210,22 @@ describe Ci::CreatePipelineService, services: true do expect(result.manual_actions).not_to be_empty end end + + context 'with environment' do + before do + config = YAML.dump(deploy: { environment: { name: "review/$CI_BUILD_REF_NAME" }, script: 'ls' }) + stub_ci_pipeline_yaml_file(config) + end + + it 'creates the environment' do + result = execute(ref: 'refs/heads/master', + before: '00000000', + after: project.commit.id, + commits: [{ message: 'some msg' }]) + + expect(result).to be_persisted + expect(Environment.find_by(name: "review/master")).not_to be_nil + end + end end end |