Skip to content

Commit

Permalink
fix rubocop problems in event previews
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Dec 1, 2024
1 parent d4e37f0 commit 8b3ec68
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
class Events::RubygemEvent::Version::PushedComponentPreview < Lookbook::Preview
def default(rubygem: Rubygem.first!, # rubocop:disable Metrics/ParameterLists
number: "1.0.0", platform: "ruby",
version_gid: rubygem.versions.where(number:, platform:).first&.to_gid,
pushed_by: "Pusher", actor_gid: version_gid&.find&.pusher&.to_gid)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_PUSHED, additional:
{
number:,
platform:,
pushed_by:,
def default(rubygem: Rubygem.first!, **additional)
additional[:number] ||= "1.0.0"
additional[:platform] ||= "ruby"
version = rubygem.versions.find_by(additional.slice(:number, :platform))
additional[:version_gid] ||= version&.to_gid
additional[:actor_gid] ||= version&.pusher&.to_gid
additional[:pushed_by] ||= "Pusher"

version_gid:,
actor_gid:
})
render Events::RubygemEvent::Version::PushedComponent.new(
event:
)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_PUSHED, additional:)
render Events::RubygemEvent::Version::PushedComponent.new(event:)
end
end
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
class Events::RubygemEvent::Version::YankForbiddenComponentPreview < Lookbook::Preview
def default(rubygem: Rubygem.first!, # rubocop:disable Metrics/ParameterLists
reason: "Versions used for testing can't be yanked.",
number: "0.0.1", platform: "ruby",
version_gid: rubygem.versions.where(number:, platform:).first&.to_gid,
yanked_by: "Yanker", actor_gid: version_gid&.find&.yanker&.to_gid)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_YANK_FORBIDDEN, additional:
{
number:,
platform:,
yanked_by:,
def default(rubygem: Rubygem.first!, **additional)
additional[:reason] ||= "Versions used for testing can't be yanked."
additional[:number] ||= "0.0.1"
additional[:platform] ||= "ruby"
version = rubygem.versions.find_by(additional.slice(:number, :platform))
additional[:version_gid] ||= version&.to_gid
additional[:actor_gid] ||= version&.yanker&.to_gid
additional[:yanked_by] ||= "Yanker"

version_gid:,
actor_gid:,
reason:
})
render Events::RubygemEvent::Version::YankForbiddenComponent.new(
event:
)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_YANK_FORBIDDEN, additional:)
render Events::RubygemEvent::Version::YankForbiddenComponent.new(event:)
end
end
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
class Events::RubygemEvent::Version::YankedComponentPreview < Lookbook::Preview
def default(rubygem: Rubygem.first!, # rubocop:disable Metrics/ParameterLists
number: "0.0.1", platform: "ruby",
version_gid: rubygem.versions.where(number:, platform:).first&.to_gid,
yanked_by: "Yanker", actor_gid: version_gid&.find&.yanker&.to_gid)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_YANKED, additional:
{
number:,
platform:,
yanked_by:,
def default(rubygem: Rubygem.first!, **additional)
additional[:number] ||= "0.0.1"
additional[:platform] ||= "ruby"
version = rubygem.versions.find_by(additional.slice(:number, :platform))
additional[:version_gid] ||= version&.to_gid
additional[:actor_gid] ||= version&.yanker&.to_gid
additional[:yanked_by] ||= "Yanker"

version_gid:,
actor_gid:
})
render Events::RubygemEvent::Version::YankedComponent.new(
event:
)
event = FactoryBot.build(:events_rubygem_event, rubygem:, tag: Events::RubygemEvent::VERSION_YANKED, additional:)
render Events::RubygemEvent::Version::YankedComponent.new(event:)
end
end

0 comments on commit 8b3ec68

Please sign in to comment.