Commit 5724f589 authored by David Fernandez's avatar David Fernandez

Merge branch 'issue_344279_go_module_versions' into 'master'

Fix Style/OpenStructUse offenses go_module_versions

See merge request gitlab-org/gitlab!75217
parents cc732f12 e940bac6
...@@ -8,7 +8,6 @@ Style/OpenStructUse: ...@@ -8,7 +8,6 @@ Style/OpenStructUse:
- ee/spec/lib/gitlab/auth/group_saml/failure_handler_spec.rb - ee/spec/lib/gitlab/auth/group_saml/failure_handler_spec.rb
- ee/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb - ee/spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
- lib/gitlab/testing/request_inspector_middleware.rb - lib/gitlab/testing/request_inspector_middleware.rb
- spec/factories/go_module_versions.rb
- spec/factories/wiki_pages.rb - spec/factories/wiki_pages.rb
- spec/graphql/mutations/branches/create_spec.rb - spec/graphql/mutations/branches/create_spec.rb
- spec/graphql/mutations/clusters/agent_tokens/create_spec.rb - spec/graphql/mutations/clusters/agent_tokens/create_spec.rb
......
...@@ -5,12 +5,10 @@ FactoryBot.define do ...@@ -5,12 +5,10 @@ FactoryBot.define do
skip_create skip_create
initialize_with do initialize_with do
p = attributes[:params] s = Packages::SemVer.parse(semver, prefixed: true)
s = Packages::SemVer.parse(p.semver, prefixed: true) raise ArgumentError, "invalid sematic version: #{semver.inspect}" if !s && semver
raise ArgumentError, "invalid sematic version: '#{p.semver}'" if !s && p.semver new(mod, type, commit, name: name, semver: s, ref: ref)
new(p.mod, p.type, p.commit, name: p.name, semver: s, ref: p.ref)
end end
mod { association(:go_module) } mod { association(:go_module) }
...@@ -20,8 +18,6 @@ FactoryBot.define do ...@@ -20,8 +18,6 @@ FactoryBot.define do
semver { nil } semver { nil }
ref { nil } ref { nil }
params { OpenStruct.new(mod: mod, type: type, commit: commit, name: name, semver: semver, ref: ref) }
trait :tagged do trait :tagged do
ref { mod.project.repository.find_tag(name) } ref { mod.project.repository.find_tag(name) }
commit { ref.dereferenced_target } commit { ref.dereferenced_target }
...@@ -36,8 +32,8 @@ FactoryBot.define do ...@@ -36,8 +32,8 @@ FactoryBot.define do
.max_by(&:to_s) .max_by(&:to_s)
.to_s .to_s
end end
type { :ref }
params { OpenStruct.new(mod: mod, type: :ref, commit: commit, semver: name, ref: ref) } semver { name }
end 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