Commit bcdf86cb authored by Etienne Baqué's avatar Etienne Baqué

Merge branch 'vij-additional-namespace-validation' into 'master'

Additional namespace validation for AdditionalPack

See merge request gitlab-org/gitlab!67848
parents b5416567 6fdee1a7
......@@ -47,6 +47,7 @@ module Ci
raise ChangeNamespaceError, 'Target namespace must be provided' unless target.present?
raise ChangeNamespaceError, 'Namespace must be a top-level namespace' unless namespace.root?
raise ChangeNamespaceError, 'Target namespace must be a top-level namespace' unless target.root?
raise ChangeNamespaceError, 'Namespace and target must be different' if namespace == target
end
def validate_owners!
......
......@@ -123,6 +123,15 @@ RSpec.describe Ci::Minutes::AdditionalPacks::ChangeNamespaceService do
expect(change_namespace[:message]).to eq 'Both namespaces must share the same owner'
end
end
context 'when the namespace is the same as the target' do
let(:target) { namespace }
it 'returns an error' do
expect(change_namespace[:status]).to eq :error
expect(change_namespace[:message]).to eq 'Namespace and target must be different'
end
end
end
end
end
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