diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 13:36:35 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 13:36:35 +0200 |
commit | 55aa727eff50a9472405b302645abb54f28bdba0 (patch) | |
tree | 7b1fa36999fa3e74f43158448e72596d8a3ef565 /spec/models/ci | |
parent | 7fc6b5b6ff23e2faba7f06a1362ada31f6f3436a (diff) | |
download | gitlab-ce-55aa727eff50a9472405b302645abb54f28bdba0.tar.gz |
Extract build play specs and extend test examples
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/build_spec.rb | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 8124d263fd4..09e9f5bd8ba 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -959,40 +959,8 @@ describe Ci::Build, :models do project.add_developer(user) end - context 'when user does not have ability to trigger action' do - before do - create(:protected_branch, :no_one_can_push, - name: build.ref, project: project) - end - - it 'raises an error' do - expect { build.play(user) } - .to raise_error Gitlab::Access::AccessDeniedError - end - end - - context 'when user has ability to trigger manual action' do - context 'when build is manual' do - it 'enqueues a build' do - new_build = build.play(user) - - expect(new_build).to be_pending - expect(new_build).to eq(build) - end - end - - context 'when build is not manual' do - before do - build.update(status: 'success') - end - - it 'creates a new build' do - new_build = build.play(user) - - expect(new_build).to be_pending - expect(new_build).not_to eq(build) - end - end + it 'enqueues the build' do + expect(build.play(user)).to be_pending end end |