diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-04 05:58:28 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-04 21:56:41 +0800 |
commit | 28553dbc05989b698777ee085aa2a357ffe576d2 (patch) | |
tree | 8005538c73dd33ce949047d201f8d2b55ba2294e /spec/lib | |
parent | 005870d5ce1a00b3405d0ae3a639d0c4befcb7a2 (diff) | |
download | gitlab-ce-28553dbc05989b698777ee085aa2a357ffe576d2.tar.gz |
Update tests due to permission changes
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/status/build/cancelable_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/factory_spec.rb | 25 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/retryable_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/stop_spec.rb | 2 |
4 files changed, 20 insertions, 11 deletions
diff --git a/spec/lib/gitlab/ci/status/build/cancelable_spec.rb b/spec/lib/gitlab/ci/status/build/cancelable_spec.rb index 114d2490490..e7b880c9b09 100644 --- a/spec/lib/gitlab/ci/status/build/cancelable_spec.rb +++ b/spec/lib/gitlab/ci/status/build/cancelable_spec.rb @@ -48,7 +48,7 @@ describe Gitlab::Ci::Status::Build::Cancelable do describe '#has_action?' do context 'when user is allowed to update build' do before do - build.project.team << [user, :developer] + build.project.add_master(user) end it { is_expected.to have_action } diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index c8a97016f20..bc21b8af67c 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -7,7 +7,7 @@ describe Gitlab::Ci::Status::Build::Factory do let(:factory) { described_class.new(build, user) } before do - project.team << [user, :developer] + project.add_master(user) end context 'when build is successful' do @@ -225,19 +225,20 @@ describe Gitlab::Ci::Status::Build::Factory do end context 'when user has ability to play action' do - before do - project.add_developer(user) - - create(:protected_branch, :developers_can_merge, - name: build.ref, project: project) - end - it 'fabricates status that has action' do expect(status).to have_action end end context 'when user does not have ability to play action' do + before do + project.team.truncate + project.add_developer(user) + + create(:protected_branch, :no_one_can_push, + name: build.ref, project: project) + end + it 'fabricates status that has no action' do expect(status).not_to have_action end @@ -262,6 +263,14 @@ describe Gitlab::Ci::Status::Build::Factory do end context 'when user is not allowed to execute manual action' do + before do + project.team.truncate + project.add_developer(user) + + create(:protected_branch, :no_one_can_push, + name: build.ref, project: project) + end + it 'fabricates status with correct details' do expect(status.text).to eq 'manual' expect(status.group).to eq 'manual' diff --git a/spec/lib/gitlab/ci/status/build/retryable_spec.rb b/spec/lib/gitlab/ci/status/build/retryable_spec.rb index 099d873fc01..ed9752b4ed6 100644 --- a/spec/lib/gitlab/ci/status/build/retryable_spec.rb +++ b/spec/lib/gitlab/ci/status/build/retryable_spec.rb @@ -48,7 +48,7 @@ describe Gitlab::Ci::Status::Build::Retryable do describe '#has_action?' do context 'when user is allowed to update build' do before do - build.project.team << [user, :developer] + build.project.add_master(user) end it { is_expected.to have_action } diff --git a/spec/lib/gitlab/ci/status/build/stop_spec.rb b/spec/lib/gitlab/ci/status/build/stop_spec.rb index 23902f26b1a..7fe3cf7ea6d 100644 --- a/spec/lib/gitlab/ci/status/build/stop_spec.rb +++ b/spec/lib/gitlab/ci/status/build/stop_spec.rb @@ -20,7 +20,7 @@ describe Gitlab::Ci::Status::Build::Stop do describe '#has_action?' do context 'when user is allowed to update build' do before do - build.project.team << [user, :developer] + build.project.add_master(user) end it { is_expected.to have_action } |