summaryrefslogtreecommitdiff
path: root/spec/requests/api/triggers_spec.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-18 23:39:51 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-12-18 23:39:51 +0100
commit14d47884dff6844625c2e65b247fd773d78f5ea2 (patch)
tree10fba027e61521df236fd6eec7ba829c5fe2c8ec /spec/requests/api/triggers_spec.rb
parent9fd775def2d89500cf291fe675458b68ead7cd2c (diff)
parent546fa165ff728bc2d25ed9b55b95dd1d48139d4a (diff)
downloadgitlab-ce-14d47884dff6844625c2e65b247fd773d78f5ea2.tar.gz
Merge remote-tracking branch 'origin/master' into dockerfile-templatesdockerfile-templates
Diffstat (limited to 'spec/requests/api/triggers_spec.rb')
-rw-r--r--spec/requests/api/triggers_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb
index 82bba1ce8a4..67ec3168679 100644
--- a/spec/requests/api/triggers_spec.rb
+++ b/spec/requests/api/triggers_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe API::API do
+describe API::Triggers do
include ApiHelpers
let(:user) { create(:user) }
@@ -54,6 +54,13 @@ describe API::API do
expect(pipeline.builds.size).to eq(5)
end
+ it 'creates builds on webhook from other gitlab repository and branch' do
+ expect do
+ post api("/projects/#{project.id}/ref/master/trigger/builds?token=#{trigger_token}"), { ref: 'refs/heads/other-branch' }
+ end.to change(project.builds, :count).by(5)
+ expect(response).to have_http_status(201)
+ end
+
it 'returns bad request with no builds created if there\'s no commit for that ref' do
post api("/projects/#{project.id}/trigger/builds"), options.merge(ref: 'other-branch')
expect(response).to have_http_status(400)
@@ -68,7 +75,7 @@ describe API::API do
it 'validates variables to be a hash' do
post api("/projects/#{project.id}/trigger/builds"), options.merge(variables: 'value', ref: 'master')
expect(response).to have_http_status(400)
- expect(json_response['message']).to eq('variables needs to be a hash')
+ expect(json_response['error']).to eq('variables is invalid')
end
it 'validates variables needs to be a map of key-valued strings' do