Skip to content

Commit

Permalink
Remove support for EOL Rails 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon committed Jun 26, 2022
1 parent 253a084 commit 03a26c1
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inherit_mode:

AllCops:
TargetRubyVersion: 2.5
TargetRailsVersion: 5.2
TargetRailsVersion: 6.0
DisplayCopNames: true
DisplayStyleGuide: true
Include:
Expand Down
7 changes: 0 additions & 7 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# frozen_string_literal: true
ruby_2 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
ruby_27_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
ruby_31_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
jruby = RUBY_PLATFORM.include?('java')

if ruby_2
appraise "rails-5.2" do
gem "rails", "~> 5.2.0"
end
end

unless ruby_31_or_higher # https://github.com/rails/rails/issues/44090#issuecomment-1007686519
appraise "rails-6.0" do
gem "rails", "~> 6.0.0"
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ PATH
remote: .
specs:
good_job (2.99.0)
activejob (>= 5.2.0)
activerecord (>= 5.2.0)
activejob (>= 6.0.0)
activerecord (>= 6.0.0)
concurrent-ruby (>= 1.0.2)
fugit (>= 1.1)
railties (>= 5.2.0)
railties (>= 6.0.0)
thor (>= 0.14.1)
webrick (>= 1.3)
zeitwerk (>= 2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/good_job/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<%= tag.script "", src: rails_ujs_path(format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
<%= tag.script "", src: es_module_shims_path(format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
<% importmaps = { imports: GoodJob::AssetsController.js_modules.keys.each_with_object({}) { |module_name, imports| imports[module_name] = modules_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } } %>
<% importmaps = { imports: GoodJob::AssetsController.js_modules.keys.index_with { |module_name| modules_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } } %>
<%= tag.script importmaps.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce %>
<%= tag.script "", src: scripts_path(format: :js, v: GoodJob::VERSION, locale: nil), type: "module", nonce: content_security_policy_nonce %>
</head>
Expand Down
29 changes: 0 additions & 29 deletions gemfiles/rails_5.2.gemfile

This file was deleted.

6 changes: 3 additions & 3 deletions good_job.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.5.0"

spec.add_dependency "activejob", ">= 5.2.0"
spec.add_dependency "activerecord", ">= 5.2.0"
spec.add_dependency "activejob", ">= 6.0.0"
spec.add_dependency "activerecord", ">= 6.0.0"
spec.add_dependency "concurrent-ruby", ">= 1.0.2"
spec.add_dependency "fugit", ">= 1.1"
spec.add_dependency "railties", ">= 5.2.0"
spec.add_dependency "railties", ">= 6.0.0"
spec.add_dependency "thor", ">= 0.14.1"
spec.add_dependency "webrick", ">= 1.3"
spec.add_dependency "zeitwerk", ">= 2.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/good_job/current_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def self.reset(values = {})
# Exports values to hash
# @return [Hash]
def self.to_h
ACCESSORS.each_with_object({}) do |accessor, hash|
hash[accessor] = send(accessor)
ACCESSORS.index_with do |accessor|
send(accessor)
end
end

Expand Down
41 changes: 19 additions & 22 deletions spec/lib/models/good_job/execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,32 +289,29 @@ def perform(result_value = nil, raise_error: false)
expect(result.unhandled_error).to be_an_instance_of TestJob::ExpectedError
end

if Gem::Version.new(Rails.version) > Gem::Version.new("6")
# Necessary instrumentation was added in Rails 6.0
context 'when retry_on is used' do
before do
TestJob.retry_on(StandardError, wait: 0, attempts: Float::INFINITY) { nil }
end

it 'returns the error' do
result = good_job.perform

expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
context 'when retry_on is used' do
before do
TestJob.retry_on(StandardError, wait: 0, attempts: Float::INFINITY) { nil }
end

context 'when discard_on is used' do
before do
TestJob.discard_on(StandardError) { nil }
end
it 'returns the error' do
result = good_job.perform

it 'returns the error' do
result = good_job.perform
expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
end

context 'when discard_on is used' do
before do
TestJob.discard_on(StandardError) { nil }
end

it 'returns the error' do
result = good_job.perform

expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
expect(result.value).to be_nil
expect(result.handled_error).to be_an_instance_of TestJob::ExpectedError
end
end
end
Expand Down

0 comments on commit 03a26c1

Please sign in to comment.