Skip to content

Commit c6fd9d7

Browse files
committed
Actually drop Rails < 7.0
The v3.0.0 changelog mentions that Rails 6.1 support was dropped, which was done by removing it from the CI matrix. However, there's still some code that checks for versions lower than 7.0, and 6.1 is still included on the gemspec. This commit addresses that by changing the dependency version, and removing code that isn't needed anymore.
1 parent ddab2d1 commit c6fd9d7

5 files changed

Lines changed: 8 additions & 24 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PATH
22
remote: .
33
specs:
44
noticed (3.0.0)
5-
rails (>= 6.1.0)
5+
rails (>= 7.0.0)
66

77
GEM
88
remote: https://rubygems.org/

app/models/concerns/noticed/deliverable.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,7 @@ def deliver(recipients = nil, enqueue_job: true, **options)
9696
self.notifications_count = recipients_attributes.size
9797
save!
9898

99-
if Rails.gem_version >= Gem::Version.new("7.0.0.alpha1")
100-
notifications.insert_all!(recipients_attributes, record_timestamps: true) if recipients_attributes.any?
101-
else
102-
time = Time.current
103-
recipients_attributes.each do |attributes|
104-
attributes[:created_at] = time
105-
attributes[:updated_at] = time
106-
end
107-
notifications.insert_all!(recipients_attributes) if recipients_attributes.any?
108-
end
99+
notifications.insert_all!(recipients_attributes, record_timestamps: true) if recipients_attributes.any?
109100
end
110101

111102
# Enqueue delivery job

app/models/noticed/event.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ class Event < ApplicationRecord
1616

1717
# Ephemeral notifiers cannot serialize params since they aren't ActiveRecord backed
1818
if respond_to? :serialize
19-
if Rails.gem_version >= Gem::Version.new("7.1.0.alpha")
20-
serialize :params, coder: Coder
21-
else
22-
serialize :params, Coder
23-
end
19+
serialize :params, coder: Coder
2420
end
2521
end
2622
end

noticed.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Gem::Specification.new do |spec|
1616

1717
spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
1818

19-
spec.add_dependency "rails", ">= 6.1.0"
19+
spec.add_dependency "rails", ">= 7.0.0"
2020
end

test/notifier_test.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,10 @@ class RecipientsLambdaEphemeral < Noticed::Ephemeral
217217
end
218218
end
219219

220-
# assert_enqeued_with doesn't support priority before Rails 7
221-
if Rails.gem_version >= Gem::Version.new("7.0.0.alpha1")
222-
test "priority delivery method option" do
223-
event = PriorityNotifier.deliver(User.first)
224-
assert_enqueued_with(job: Noticed::DeliveryMethods::Test, args: [:test, event.notifications.last], priority: 2) do
225-
perform_enqueued_jobs
226-
end
220+
test "priority delivery method option" do
221+
event = PriorityNotifier.deliver(User.first)
222+
assert_enqueued_with(job: Noticed::DeliveryMethods::Test, args: [:test, event.notifications.last], priority: 2) do
223+
perform_enqueued_jobs
227224
end
228225
end
229226

0 commit comments

Comments
 (0)