summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 2fe50f8c48a..30114d36a06 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -7119,7 +7119,7 @@ RSpec.describe Project, factory_default: :keep do
describe '#package_already_taken?' do
let_it_be(:namespace) { create(:namespace, path: 'test') }
let_it_be(:project) { create(:project, :public, namespace: namespace) }
- let_it_be(:package) { create(:npm_package, project: project, name: "@#{namespace.path}/foo", version: '1.2.3') }
+ let_it_be_with_reload(:package) { create(:npm_package, project: project, name: "@#{namespace.path}/foo", version: '1.2.3') }
subject { project.package_already_taken?(package_name, package_version, package_type: :npm) }
@@ -7158,6 +7158,23 @@ RSpec.describe Project, factory_default: :keep do
expect(result).to be false
end
end
+
+ context 'with a pending_destruction package' do
+ before do
+ package.pending_destruction!
+ end
+
+ where(:package_name, :package_version, :expected_result) do
+ '@test/bar' | '1.2.3' | false
+ '@test/bar' | '5.5.5' | false
+ '@test/foo' | '1.2.3' | false
+ '@test/foo' | '5.5.5' | false
+ end
+
+ with_them do
+ it { is_expected.to eq expected_result}
+ end
+ end
end
end