diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2018-11-05 11:45:36 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2018-11-05 11:45:36 +0000 |
commit | 425ddcc5a8f65b44546daa8c1885e4e4f45e5f32 (patch) | |
tree | 686da2eb8ee8755f7e1bcd7a91c61559638fe547 /spec/models/ci/build_spec.rb | |
parent | 2ae6c47ddd27d9f76bc2e4326e91fc8d272896c1 (diff) | |
parent | 13c091c443502a6824b78c4e93637b3fc794a47c (diff) | |
download | gitlab-ce-425ddcc5a8f65b44546daa8c1885e4e4f45e5f32.tar.gz |
Merge branch 'scheduled-manual-jobs-environment-play-buttons' into 'master'
Add the Play button for delayed jobs in environment page
Closes #52129
See merge request gitlab-org/gitlab-ce!22106
Diffstat (limited to 'spec/models/ci/build_spec.rb')
-rw-r--r-- | spec/models/ci/build_spec.rb | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 13a4aaa8936..b07f8bc98b5 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1511,11 +1511,11 @@ describe Ci::Build do end end - describe '#other_actions' do + describe '#other_manual_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 } + subject { build.other_manual_actions } before do project.add_developer(user) @@ -1546,6 +1546,48 @@ describe Ci::Build do end end + describe '#other_scheduled_actions' do + let(:build) { create(:ci_build, :scheduled, pipeline: pipeline) } + + subject { build.other_scheduled_actions } + + before do + project.add_developer(user) + end + + context "when other build's status is success" do + let!(:other_build) { create(:ci_build, :schedulable, :success, pipeline: pipeline, name: 'other action') } + + it 'returns other actions' do + is_expected.to contain_exactly(other_build) + end + end + + context "when other build's status is failed" do + let!(:other_build) { create(:ci_build, :schedulable, :failed, pipeline: pipeline, name: 'other action') } + + it 'returns other actions' do + is_expected.to contain_exactly(other_build) + end + end + + context "when other build's status is running" do + let!(:other_build) { create(:ci_build, :schedulable, :running, pipeline: pipeline, name: 'other action') } + + it 'does not return other actions' do + is_expected.to be_empty + end + end + + context "when other build's status is scheduled" do + let!(:other_build) { create(:ci_build, :scheduled, pipeline: pipeline, name: 'other action') } + + it 'does not return other actions' do + is_expected.to contain_exactly(other_build) + end + end + end + describe '#persisted_environment' do let!(:environment) do create(:environment, project: project, name: "foo-#{project.default_branch}") |