summaryrefslogtreecommitdiff
path: root/spec/models/dependency_proxy/manifest_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/dependency_proxy/manifest_spec.rb')
-rw-r--r--spec/models/dependency_proxy/manifest_spec.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/models/dependency_proxy/manifest_spec.rb b/spec/models/dependency_proxy/manifest_spec.rb
index aa2e73356dd..4203644c003 100644
--- a/spec/models/dependency_proxy/manifest_spec.rb
+++ b/spec/models/dependency_proxy/manifest_spec.rb
@@ -29,24 +29,32 @@ RSpec.describe DependencyProxy::Manifest, type: :model do
end
end
- describe '.find_or_initialize_by_file_name' do
- subject { DependencyProxy::Manifest.find_or_initialize_by_file_name(file_name) }
+ describe '.find_or_initialize_by_file_name_or_digest' do
+ let_it_be(:file_name) { 'foo' }
+ let_it_be(:digest) { 'bar' }
- context 'no manifest exists' do
- let_it_be(:file_name) { 'foo' }
+ subject { DependencyProxy::Manifest.find_or_initialize_by_file_name_or_digest(file_name: file_name, digest: digest) }
+ context 'no manifest exists' do
it 'initializes a manifest' do
- expect(DependencyProxy::Manifest).to receive(:new).with(file_name: file_name)
+ expect(DependencyProxy::Manifest).to receive(:new).with(file_name: file_name, digest: digest)
subject
end
end
- context 'manifest exists' do
+ context 'manifest exists and matches file_name' do
let_it_be(:dependency_proxy_manifest) { create(:dependency_proxy_manifest) }
let_it_be(:file_name) { dependency_proxy_manifest.file_name }
it { is_expected.to eq(dependency_proxy_manifest) }
end
+
+ context 'manifest exists and matches digest' do
+ let_it_be(:dependency_proxy_manifest) { create(:dependency_proxy_manifest) }
+ let_it_be(:digest) { dependency_proxy_manifest.digest }
+
+ it { is_expected.to eq(dependency_proxy_manifest) }
+ end
end
end