Commit 07980eff authored by Jason Goodman's avatar Jason Goodman

Fix expectation set on nil warning in namespace spec

Namespace owner was sometimes nil in sync_name_with_customers_dot spec
parent 1a88a78b
...@@ -358,6 +358,7 @@ RSpec.describe Namespace do ...@@ -358,6 +358,7 @@ RSpec.describe Namespace do
end end
describe 'after_commit :sync_name_with_customers_dot' do describe 'after_commit :sync_name_with_customers_dot' do
let(:owner) { create(:user) }
let(:namespace) { create(:group) } let(:namespace) { create(:group) }
let(:privatized_by_abuse_automation) { false } let(:privatized_by_abuse_automation) { false }
...@@ -365,7 +366,7 @@ RSpec.describe Namespace do ...@@ -365,7 +366,7 @@ RSpec.describe Namespace do
before do before do
allow(Gitlab).to receive(:com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
allow(namespace.owner).to receive(:privatized_by_abuse_automation?) allow(owner).to receive(:privatized_by_abuse_automation?)
.and_return(privatized_by_abuse_automation) .and_return(privatized_by_abuse_automation)
end end
...@@ -389,6 +390,10 @@ RSpec.describe Namespace do ...@@ -389,6 +390,10 @@ RSpec.describe Namespace do
context 'when the name is not updated' do context 'when the name is not updated' do
let(:attributes) { { path: 'Foo' } } let(:attributes) { { path: 'Foo' } }
before do
namespace.add_owner(owner)
end
include_examples 'no sync' include_examples 'no sync'
end end
...@@ -404,7 +409,7 @@ RSpec.describe Namespace do ...@@ -404,7 +409,7 @@ RSpec.describe Namespace do
end end
context 'when project namespace' do context 'when project namespace' do
let(:namespace) { create(:project_namespace) } let(:namespace) { create(:project_namespace, owner: owner) }
context 'when the owner is privatized by abuse automation' do context 'when the owner is privatized by abuse automation' do
let(:privatized_by_abuse_automation) { true } let(:privatized_by_abuse_automation) { true }
...@@ -418,6 +423,10 @@ RSpec.describe Namespace do ...@@ -418,6 +423,10 @@ RSpec.describe Namespace do
end end
context 'when group namespace' do context 'when group namespace' do
before do
namespace.add_owner(owner)
end
context 'when the owner is privatized by abuse automation' do context 'when the owner is privatized by abuse automation' do
let(:privatized_by_abuse_automation) { true } let(:privatized_by_abuse_automation) { true }
...@@ -430,7 +439,7 @@ RSpec.describe Namespace do ...@@ -430,7 +439,7 @@ RSpec.describe Namespace do
end end
context 'when user namespace' do context 'when user namespace' do
let(:namespace) { create(:namespace) } let(:namespace) { create(:namespace, owner: owner) }
context 'when the owner is privatized by abuse automation' do context 'when the owner is privatized by abuse automation' do
let(:privatized_by_abuse_automation) { true } let(:privatized_by_abuse_automation) { true }
......
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