diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-05-31 09:47:53 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-06-01 14:23:46 +0200 |
commit | 6ae16b6d4d9fb79b715875073bb78efd3f56929b (patch) | |
tree | e207b971b7c5d90ad6d72545e7270bd330c9a244 /spec/requests/api | |
parent | 9b2e19fe37a5d1389e9f83531bb6ba4b06a66de0 (diff) | |
download | gitlab-ce-6ae16b6d4d9fb79b715875073bb78efd3f56929b.tar.gz |
Rename variables_attributes => variables and adds spec for exclude/only option
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/pipelines_spec.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index f20c2275152..0c6bb56e11d 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -302,17 +302,32 @@ describe API::Pipelines do end context 'variables given' do - let(:variables_attributes) { [{ 'key' => 'UPLOAD_TO_S3', 'value' => 'true' }] } + let(:variables) { [{ 'key' => 'UPLOAD_TO_S3', 'value' => 'true' }] } it 'creates and returns a new pipeline using the given variables' do expect do - post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables_attributes: variables_attributes + post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch, variables: variables end.to change { project.pipelines.count }.by(1) expect(response).to have_gitlab_http_status(201) expect(json_response).to be_a Hash expect(json_response['sha']).to eq project.commit.id - expect(json_response['variables']).to eq variables_attributes + expect(json_response['variables']).to eq variables + end + end + + context 'when excluding a ref' do + before do + config = YAML.dump(test: { script: 'test', except: [project.default_branch] }) + stub_ci_pipeline_yaml_file(config) + end + + it "doesn't not create a job for the exluded ref" do + expect do + post api("/projects/#{project.id}/pipeline", user), ref: project.default_branch + end.not_to change { project.pipelines.count } + + expect(response).to have_gitlab_http_status(400) end end |