Commit 4e3ec6da authored by charlie ablett's avatar charlie ablett

Modify Namespace spec factory to always have a type

Because `nil` type implicitly meant 'User' namespace, and we are phasing out `nil` namespace type.
parent 093f6884
# frozen_string_literal: true # frozen_string_literal: true
FactoryBot.define do FactoryBot.define do
factory :namespace do # This factory is called :namespace but actually maps (and always has) to User type
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74152#note_730034103 for context
factory :namespace, class: 'Namespaces::UserNamespace' do
sequence(:name) { |n| "namespace#{n}" } sequence(:name) { |n| "namespace#{n}" }
type { Namespaces::UserNamespace.sti_name }
path { name.downcase.gsub(/\s/, '_') } path { name.downcase.gsub(/\s/, '_') }
owner { association(:user, strategy: :build, namespace: instance, username: path) } owner { association(:user, strategy: :build, namespace: instance, username: path) }
......
...@@ -21,7 +21,7 @@ RSpec.describe Namespace::TraversalHierarchy, type: :model do ...@@ -21,7 +21,7 @@ RSpec.describe Namespace::TraversalHierarchy, type: :model do
end end
context 'with group outside of hierarchy' do context 'with group outside of hierarchy' do
let(:group) { create(:namespace) } let(:group) { create(:group) }
it { expect(hierarchy.root).not_to eq root } it { expect(hierarchy.root).not_to eq root }
end end
......
...@@ -346,7 +346,8 @@ RSpec.shared_examples 'a pypi user namespace endpoint' do ...@@ -346,7 +346,8 @@ RSpec.shared_examples 'a pypi user namespace endpoint' do
end end
with_them do with_them do
let_it_be_with_reload(:group) { create(:namespace) } # only groups are supported, so this "group" is actually the wrong namespace type
let_it_be_with_reload(:group) { create(:user_namespace) }
let(:headers) { user_role == :anonymous ? {} : basic_auth_header(user.username, personal_access_token.token) } let(:headers) { user_role == :anonymous ? {} : basic_auth_header(user.username, personal_access_token.token) }
before do before do
......
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