summaryrefslogtreecommitdiff
path: root/spec/models/build_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-07-19 21:24:40 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-07-19 21:24:40 +0800
commit87604ed6ceb7d088dd4ebbc20185fe6ef46180c5 (patch)
treef856fdec8195f1484453b9d86d9947fb43d4cf58 /spec/models/build_spec.rb
parent08b9532e376eae369cd04d9f86ea560acfd19ed0 (diff)
parente57c0c89f082e98f0fa0f3bd5ab0778c7304c41e (diff)
downloadgitlab-ce-87604ed6ceb7d088dd4ebbc20185fe6ef46180c5.tar.gz
Merge branch 'master' into artifacts-from-ref-and-build-name-api
* master: (23 commits) Add CHANGELOG entry [ci skip] CHANGELOG item Added redirect_to_referer to login link on issues Simplify entities for branches and tags API Added Rake task for tracking deployments Return the number of marked todos Use local_assigns Use `humanize` Improve code design Remove unused create_pipeline_service_spec.rb Add notice implementation Make manual actions to work with master code Use `capitalize` instead of `titleize` for manual actions Mark builds with manual actions as skipped Fix rubocop offenses Update build fixtures to include manual actions Improve manual actions code and add model, service and feature tests Rename playable_actions to manual_actions Add implementation of manual actions Position commit icons closer to branch name/tag/sha; add min-width to pipeline actions cell ...
Diffstat (limited to 'spec/models/build_spec.rb')
-rw-r--r--spec/models/build_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 355cb8fdfff..bd120e84c8f 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -713,4 +713,55 @@ describe Ci::Build, models: true do
end
end
end
+
+ describe '#manual?' do
+ before do
+ build.update(when: value)
+ end
+
+ subject { build.manual? }
+
+ context 'when is set to manual' do
+ let(:value) { 'manual' }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when set to something else' do
+ let(:value) { 'something else' }
+
+ it { is_expected.to be_falsey }
+ end
+ end
+
+ describe '#other_actions' do
+ let(:build) { create(:ci_build, :manual, pipeline: pipeline) }
+ let!(:other_build) { create(:ci_build, :manual, pipeline: pipeline, name: 'other action') }
+
+ subject { build.other_actions }
+
+ it 'returns other actions' do
+ is_expected.to contain_exactly(other_build)
+ end
+ end
+
+ describe '#play' do
+ let(:build) { create(:ci_build, :manual, pipeline: pipeline) }
+
+ subject { build.play }
+
+ it 'enques a build' do
+ is_expected.to be_pending
+ is_expected.to eq(build)
+ end
+
+ context 'for success build' do
+ before { build.queue }
+
+ it 'creates a new build' do
+ is_expected.to be_pending
+ is_expected.not_to eq(build)
+ end
+ end
+ end
end