Commit 3461e1cc authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'pl-rubocop-inline-association-package' into 'master'

Fix cop FactoryBot/InlineAssociation for package factories

See merge request gitlab-org/gitlab!47395
parents 2de7ac3b d3b2d7ba
...@@ -16,8 +16,6 @@ FactoryBot/InlineAssociation: ...@@ -16,8 +16,6 @@ FactoryBot/InlineAssociation:
- 'spec/factories/import_export_uploads.rb' - 'spec/factories/import_export_uploads.rb'
- 'spec/factories/merge_requests.rb' - 'spec/factories/merge_requests.rb'
- 'spec/factories/notes.rb' - 'spec/factories/notes.rb'
- 'spec/factories/packages.rb'
- 'spec/factories/packages/package_file.rb'
- 'spec/factories/sent_notifications.rb' - 'spec/factories/sent_notifications.rb'
- 'spec/factories/uploads.rb' - 'spec/factories/uploads.rb'
- 'spec/factories/wiki_pages.rb' - 'spec/factories/wiki_pages.rb'
......
...@@ -129,7 +129,7 @@ FactoryBot.define do ...@@ -129,7 +129,7 @@ FactoryBot.define do
end end
trait(:without_loaded_metadatum) do trait(:without_loaded_metadatum) do
conan_metadatum { build(:conan_metadatum, package: nil) } conan_metadatum { build(:conan_metadatum, package: nil) } # rubocop:disable FactoryBot/InlineAssociation
end end
end end
...@@ -141,7 +141,7 @@ FactoryBot.define do ...@@ -141,7 +141,7 @@ FactoryBot.define do
end end
factory :composer_metadatum, class: 'Packages::Composer::Metadatum' do factory :composer_metadatum, class: 'Packages::Composer::Metadatum' do
package { create(:composer_package) } package { association(:composer_package) }
target_sha { '123' } target_sha { '123' }
composer_json { { name: 'foo' } } composer_json { { name: 'foo' } }
...@@ -166,12 +166,12 @@ FactoryBot.define do ...@@ -166,12 +166,12 @@ FactoryBot.define do
end end
factory :pypi_metadatum, class: 'Packages::Pypi::Metadatum' do factory :pypi_metadatum, class: 'Packages::Pypi::Metadatum' do
package { create(:pypi_package, without_loaded_metadatum: true) } package { association(:pypi_package, without_loaded_metadatum: true) }
required_python { '>=2.7' } required_python { '>=2.7' }
end end
factory :nuget_metadatum, class: 'Packages::Nuget::Metadatum' do factory :nuget_metadatum, class: 'Packages::Nuget::Metadatum' do
package { create(:nuget_package) } package { association(:nuget_package) }
license_url { 'http://www.gitlab.com' } license_url { 'http://www.gitlab.com' }
project_url { 'http://www.gitlab.com' } project_url { 'http://www.gitlab.com' }
...@@ -179,7 +179,7 @@ FactoryBot.define do ...@@ -179,7 +179,7 @@ FactoryBot.define do
end end
factory :conan_file_metadatum, class: 'Packages::Conan::FileMetadatum' do factory :conan_file_metadatum, class: 'Packages::Conan::FileMetadatum' do
package_file { create(:conan_package_file, :conan_recipe_file, without_loaded_metadatum: true) } package_file { association(:conan_package_file, :conan_recipe_file, without_loaded_metadatum: true) }
recipe_revision { '0' } recipe_revision { '0' }
conan_file_type { 'recipe_file' } conan_file_type { 'recipe_file' }
...@@ -188,7 +188,7 @@ FactoryBot.define do ...@@ -188,7 +188,7 @@ FactoryBot.define do
end end
trait(:package_file) do trait(:package_file) do
package_file { create(:conan_package_file, :conan_package, without_loaded_metadatum: true) } package_file { association(:conan_package_file, :conan_package, without_loaded_metadatum: true) }
conan_file_type { 'package_file' } conan_file_type { 'package_file' }
package_revision { '0' } package_revision { '0' }
conan_package_reference { '123456789' } conan_package_reference { '123456789' }
...@@ -201,8 +201,8 @@ FactoryBot.define do ...@@ -201,8 +201,8 @@ FactoryBot.define do
end end
factory :packages_dependency_link, class: 'Packages::DependencyLink' do factory :packages_dependency_link, class: 'Packages::DependencyLink' do
package { create(:nuget_package) } package { association(:nuget_package) }
dependency { create(:packages_dependency) } dependency { association(:packages_dependency) }
dependency_type { :dependencies } dependency_type { :dependencies }
trait(:with_nuget_metadatum) do trait(:with_nuget_metadatum) do
...@@ -213,7 +213,7 @@ FactoryBot.define do ...@@ -213,7 +213,7 @@ FactoryBot.define do
end end
factory :nuget_dependency_link_metadatum, class: 'Packages::Nuget::DependencyLinkMetadatum' do factory :nuget_dependency_link_metadatum, class: 'Packages::Nuget::DependencyLinkMetadatum' do
dependency_link { create(:packages_dependency_link) } dependency_link { association(:packages_dependency_link) }
target_framework { '.NETStandard2.0' } target_framework { '.NETStandard2.0' }
end end
......
...@@ -15,7 +15,7 @@ FactoryBot.define do ...@@ -15,7 +15,7 @@ FactoryBot.define do
end end
factory :conan_package_file do factory :conan_package_file do
package { create(:conan_package, without_package_files: true) } package { association(:conan_package, without_package_files: true) }
transient do transient do
without_loaded_metadatum { false } without_loaded_metadatum { false }
......
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