Commit 1f015eae authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '357905-remove-subtransation-in-rubygems-metadatumextraction-service' into 'master'

Fix the rubygems extraction service to not create subtransactions

See merge request gitlab-org/gitlab!84590
parents 69086105 fea6c6b7
......@@ -49,7 +49,11 @@ module Packages
# rubocop:enable Metrics/CyclomaticComplexity
def metadatum
Packages::Rubygems::Metadatum.safe_find_or_create_by!(package: package)
# safe_find_or_create_by! was originally called here.
# We merely switched to `find_or_create_by!`
# rubocop: disable CodeReuse/ActiveRecord
Packages::Rubygems::Metadatum.find_or_create_by!(package: package)
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
......
......@@ -46,5 +46,13 @@ RSpec.describe Packages::Rubygems::MetadataExtractionService do
expect(metadata.requirements).to eq(gemspec.requirements.to_json)
expect(metadata.rubygems_version).to eq(gemspec.rubygems_version)
end
context 'with an existing metadatum' do
let_it_be(:metadatum) { create(:rubygems_metadatum, package: package) }
it 'updates it' do
expect { subject }.not_to change { Packages::Rubygems::Metadatum.count }
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