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 c72d751
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
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"
additional[:version_gid] ||= rubygem.versions.where(number:, platform:).first&.to_gid
additional[:pushed_by] ||= "Pusher"
additional[:actor_gid] ||= version_gid.find.pusher.to_gid if additional[:version_gid]

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,13 @@
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"
additional[:version_gid] ||= rubygem.versions.where(number:, platform:).first&.to_gid
additional[:yanked_by] ||= "Yanker"
additional[:actor_gid] ||= version_gid.find.yanker.to_gid if additional[:version_gid]

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,12 @@
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"
additional[:version_gid] ||= rubygem.versions.where(number:, platform:).first&.to_gid
additional[:yanked_by] ||= "Yanker"
additional[:actor_gid] ||= version_gid.find.yanker.to_gid if additional[:version_gid]

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 c72d751

Please sign in to comment.