summaryrefslogtreecommitdiff
path: root/spec/helpers/ci/triggers_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/ci/triggers_helper_spec.rb')
-rw-r--r--spec/helpers/ci/triggers_helper_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/helpers/ci/triggers_helper_spec.rb b/spec/helpers/ci/triggers_helper_spec.rb
new file mode 100644
index 00000000000..5e43dbfdd5c
--- /dev/null
+++ b/spec/helpers/ci/triggers_helper_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Ci::TriggersHelper do
+ let(:project_id) { 1 }
+
+ describe '.builds_trigger_url' do
+ subject { helper.builds_trigger_url(project_id, ref: ref) }
+
+ context 'with no ref' do
+ let(:ref) { nil }
+
+ specify { expect(subject).to eq "#{Settings.gitlab.url}/api/v4/projects/1/trigger/pipeline" }
+ end
+
+ context 'with ref' do
+ let(:ref) { 'master' }
+
+ specify { expect(subject).to eq "#{Settings.gitlab.url}/api/v4/projects/1/ref/master/trigger/pipeline" }
+ end
+ end
+
+ describe '.service_trigger_url' do
+ subject { helper.service_trigger_url(service) }
+
+ let(:service) { double(project_id: 1, to_param: 'param') }
+
+ specify { expect(subject).to eq "#{Settings.gitlab.url}/api/v4/projects/1/services/param/trigger" }
+ end
+end