summaryrefslogtreecommitdiff
path: root/spec/requests/api/triggers_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/triggers_spec.rb')
-rw-r--r--spec/requests/api/triggers_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb
index c51358bf659..55d17fabc9a 100644
--- a/spec/requests/api/triggers_spec.rb
+++ b/spec/requests/api/triggers_spec.rb
@@ -54,6 +54,15 @@ RSpec.describe API::Triggers do
expect(pipeline.builds.size).to eq(5)
end
+ it 'stores payload as a variable' do
+ post api("/projects/#{project.id}/trigger/pipeline"), params: options.merge(ref: 'master')
+
+ expect(response).to have_gitlab_http_status(:created)
+ expect(pipeline.variables.find { |v| v.key == 'TRIGGER_PAYLOAD' }.value).to eq(
+ "{\"ref\":\"master\",\"id\":\"#{project.id}\",\"variables\":{}}"
+ )
+ end
+
it 'returns bad request with no pipeline created if there\'s no commit for that ref' do
post api("/projects/#{project.id}/trigger/pipeline"), params: options.merge(ref: 'other-branch')
@@ -84,7 +93,7 @@ RSpec.describe API::Triggers do
post api("/projects/#{project.id}/trigger/pipeline"), params: options.merge(variables: variables, ref: 'master')
expect(response).to have_gitlab_http_status(:created)
- expect(pipeline.variables.map { |v| { v.key => v.value } }.last).to eq(variables)
+ expect(pipeline.variables.find { |v| v.key == 'TRIGGER_KEY' }.value).to eq('TRIGGER_VALUE')
end
end
end