diff options
| author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 13:48:43 +0200 |
|---|---|---|
| committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 13:48:43 +0200 |
| commit | 2aa211fa69ffd02ba11757e06e19d34f6ca51865 (patch) | |
| tree | cba18999257837397d1a0bcfb8e6e3de843362ff /spec/models | |
| parent | 55aa727eff50a9472405b302645abb54f28bdba0 (diff) | |
| download | gitlab-ce-2aa211fa69ffd02ba11757e06e19d34f6ca51865.tar.gz | |
Use build policy to determine if user can play build
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/ci/build_spec.rb | 27 | ||||
| -rw-r--r-- | spec/models/environment_spec.rb | 25 |
2 files changed, 0 insertions, 52 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 09e9f5bd8ba..cdceca975e5 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -925,33 +925,6 @@ describe Ci::Build, :models do end end - describe '#can_play?' do - before do - project.add_developer(user) - end - - let(:build) do - create(:ci_build, ref: 'some-ref', pipeline: pipeline) - end - - context 'when branch build is running for is protected' do - before do - create(:protected_branch, :no_one_can_push, - name: 'some-ref', project: project) - end - - it 'indicates that user can not trigger an action' do - expect(build.can_play?(user)).to be_falsey - end - end - - context 'when branch build is running for is not protected' do - it 'indicates that user can trigger an action' do - expect(build.can_play?(user)).to be_truthy - end - end - end - describe '#play' do let(:build) { create(:ci_build, :manual, pipeline: pipeline) } diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index fb7cee47ae8..9e00f2247e8 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -155,31 +155,6 @@ describe Environment, models: true do end end - describe '#can_trigger_stop_action?' do - let(:user) { create(:user) } - let(:project) { create(:project) } - - let(:environment) do - create(:environment, :with_review_app, project: project) - end - - context 'when user can trigger stop action' do - before do - project.add_developer(user) - end - - it 'returns value that evaluates to true' do - expect(environment.can_trigger_stop_action?(user)).to be_truthy - end - end - - context 'when user is not allowed to trigger stop action' do - it 'returns value that evaluates to false' do - expect(environment.can_trigger_stop_action?(user)).to be_falsey - end - end - end - describe '#stop_with_action!' do let(:user) { create(:admin) } |
