-
-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update rubocop, replace custom cop with official safe navigator cop (#…
…5292) * Fix rubocop problems in event previews
- Loading branch information
1 parent
77bbd90
commit c7bbd32
Showing
8 changed files
with
48 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
24 changes: 9 additions & 15 deletions
24
test/components/previews/events/rubygem_event/version/pushed_component_preview.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
27 changes: 10 additions & 17 deletions
27
test/components/previews/events/rubygem_event/version/yank_forbidden_component_preview.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 9 additions & 15 deletions
24
test/components/previews/events/rubygem_event/version/yanked_component_preview.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |