Commit 52ce12b6 authored by Markus Koller's avatar Markus Koller

Merge branch '350603-cablett-project-owner-specs-7' into 'master'

Replace owner with first_owner in policy specs

See merge request gitlab-org/gitlab!78860
parents 97ce01c9 5a7ef6df
...@@ -89,7 +89,7 @@ RSpec.describe Ci::PipelinePolicy, :models do ...@@ -89,7 +89,7 @@ RSpec.describe Ci::PipelinePolicy, :models do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
context 'when user has owner access' do context 'when user has owner access' do
let(:user) { project.owner } let(:user) { project.first_owner }
it 'is enabled' do it 'is enabled' do
expect(policy).to be_allowed :destroy_pipeline expect(policy).to be_allowed :destroy_pipeline
...@@ -107,7 +107,7 @@ RSpec.describe Ci::PipelinePolicy, :models do ...@@ -107,7 +107,7 @@ RSpec.describe Ci::PipelinePolicy, :models do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
context 'when user has owner access' do context 'when user has owner access' do
let(:user) { project.owner } let(:user) { project.first_owner }
it 'is enabled' do it 'is enabled' do
expect(policy).to be_allowed :read_pipeline_variable expect(policy).to be_allowed :read_pipeline_variable
...@@ -129,7 +129,7 @@ RSpec.describe Ci::PipelinePolicy, :models do ...@@ -129,7 +129,7 @@ RSpec.describe Ci::PipelinePolicy, :models do
end end
context 'when user is developer and it is not the creator of the pipeline' do context 'when user is developer and it is not the creator of the pipeline' do
let(:pipeline) { create(:ci_empty_pipeline, project: project, user: project.owner) } let(:pipeline) { create(:ci_empty_pipeline, project: project, user: project.first_owner) }
before do before do
project.add_developer(user) project.add_developer(user)
......
...@@ -28,7 +28,7 @@ RSpec.describe Namespaces::ProjectNamespacePolicy do ...@@ -28,7 +28,7 @@ RSpec.describe Namespaces::ProjectNamespacePolicy do
end end
context 'parent owner' do context 'parent owner' do
let_it_be(:current_user) { parent.owner } let_it_be(:current_user) { parent.first_owner }
it { is_expected.to be_disallowed(*permissions) } it { is_expected.to be_disallowed(*permissions) }
end end
......
...@@ -24,7 +24,7 @@ RSpec.describe ProjectMemberPolicy do ...@@ -24,7 +24,7 @@ RSpec.describe ProjectMemberPolicy do
end end
context 'when user is project owner' do context 'when user is project owner' do
let(:member_user) { project.owner } let(:member_user) { project.first_owner }
let(:member) { project.members.find_by!(user: member_user) } let(:member) { project.members.find_by!(user: member_user) }
it { is_expected.to be_allowed(:read_project) } it { is_expected.to be_allowed(:read_project) }
......
...@@ -117,7 +117,7 @@ RSpec.describe ProjectPolicy do ...@@ -117,7 +117,7 @@ RSpec.describe ProjectPolicy do
end end
describe 'for unconfirmed user' do describe 'for unconfirmed user' do
let(:current_user) { project.owner.tap { |u| u.update!(confirmed_at: nil) } } let(:current_user) { project.first_owner.tap { |u| u.update!(confirmed_at: nil) } }
it 'disallows to modify pipelines' do it 'disallows to modify pipelines' do
expect_disallowed(:create_pipeline) expect_disallowed(:create_pipeline)
...@@ -144,7 +144,7 @@ RSpec.describe ProjectPolicy do ...@@ -144,7 +144,7 @@ RSpec.describe ProjectPolicy do
end end
describe 'for project owner' do describe 'for project owner' do
let(:current_user) { project.owner } let(:current_user) { project.first_owner }
it 'allows :destroy_pipeline' do it 'allows :destroy_pipeline' do
expect(current_user.can?(:destroy_pipeline, pipeline)).to be_truthy expect(current_user.can?(:destroy_pipeline, pipeline)).to be_truthy
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment