diff options
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/ci/build_policy_spec.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index e5d5e1017cd..d8e73e4a890 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -151,10 +151,9 @@ describe Ci::BuildPolicy do end end - # TODO: Finish spec describe 'rules for erase build' do let(:project) { create(:project, :repository) } - let(:another_user) { create(:user) } + let(:build) { create(:ci_build, pipeline: pipeline, user: owner) } context 'when developer created a build' do before do @@ -162,13 +161,13 @@ describe Ci::BuildPolicy do end context 'when the build was created by the user' do - let(:build) { create(:ci_build, user: user) } + let(:owner) { user } it { expect(policy).to be_allowed :erase_build } end context 'when the build was created by others' do - let(:build) { create(:ci_build, user: another_user) } + let(:owner) { create(:user) } it { expect(policy).to be_disallowed :erase_build } end @@ -180,13 +179,13 @@ describe Ci::BuildPolicy do end context 'when the build was created by the user' do - let(:build) { create(:ci_build, user: user) } + let(:owner) { user } it { expect(policy).to be_allowed :erase_build } end context 'when the build was created by others' do - let(:build) { create(:ci_build, user: another_user) } + let(:owner) { create(:user) } it { expect(policy).to be_allowed :erase_build } end |