Commit 3b36479 1 parent 4dd9521 commit 3b36479 Copy full SHA for 3b36479
File tree 5 files changed +6
-31
lines changed
5 files changed +6
-31
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ module FixtureSupport
10
10
include ActiveRecord ::TestFixtures
11
11
12
12
# @private prevent ActiveSupport::TestFixtures to start a DB transaction.
13
- # Monkey patched to avoid collisions with 'let(:name)' in Rails 6.1 and after
14
- # and let(:method_name) before Rails 6.1.
13
+ # Monkey patched to avoid collisions with 'let(:name)' since Rails 6.1
15
14
def run_in_transaction?
16
15
current_example_name = ( RSpec . current_example && RSpec . current_example . metadata [ :description ] )
17
16
use_transactional_tests && !self . class . uses_transaction? ( current_example_name )
Original file line number Diff line number Diff line change @@ -148,8 +148,8 @@ def base_job_message(job)
148
148
msg_parts << "on queue #{ job [ :queue ] } " if job [ :queue ]
149
149
msg_parts << "at #{ Time . at ( job [ :at ] ) } " if job [ :at ]
150
150
msg_parts <<
151
- if fetch_priority ( job )
152
- "with priority #{ fetch_priority ( job ) } "
151
+ if job [ :priority ]
152
+ "with priority #{ job [ :priority ] } "
153
153
else
154
154
"with no priority specified"
155
155
end
@@ -167,17 +167,6 @@ def job_matches?(job)
167
167
@job ? @job == job [ :job ] : true
168
168
end
169
169
170
- # Rails 6.1 serializes the priority with a string key
171
- if ::Rails . version . to_f >= 7
172
- def fetch_priority ( job )
173
- job [ :priority ]
174
- end
175
- else
176
- def fetch_priority ( job )
177
- job [ 'priority' ]
178
- end
179
- end
180
-
181
170
def arguments_match? ( job )
182
171
if @args . any?
183
172
args = serialize_and_deserialize_arguments ( @args )
@@ -218,7 +207,7 @@ def queue_match?(job)
218
207
def priority_match? ( job )
219
208
return true unless @priority
220
209
221
- @priority == fetch_priority ( job )
210
+ @priority == job [ :priority ]
222
211
end
223
212
224
213
def at_match? ( job )
Original file line number Diff line number Diff line change 47
47
RSpec . describe 'Foo' do
48
48
subject { true }
49
49
50
- # Rails 6.1 and after
51
50
let ( :name ) { raise "Should never raise" }
52
- # Before Rails 6.1
53
- let ( :method_name ) { raise "Should never raise" }
54
51
55
52
it { is_expected . to be_truthy }
56
53
end
Original file line number Diff line number Diff line change @@ -56,12 +56,7 @@ def perform
56
56
57
57
describe 'error raised in perform_enqueued_jobs with block' do
58
58
it 'raises the explicitly thrown error' do
59
- # Rails 6.1+ wraps unexpected errors in tests
60
- expected_error = if Rails ::VERSION ::STRING . to_f >= 6.1
61
- Minitest ::UnexpectedError . new ( TestError )
62
- else
63
- TestError
64
- end
59
+ expected_error = Minitest ::UnexpectedError . new ( TestError )
65
60
66
61
expect { perform_enqueued_jobs { TestJob . perform_later } }
67
62
. to raise_error ( expected_error )
Original file line number Diff line number Diff line change @@ -54,12 +54,7 @@ def my_helper
54
54
end
55
55
end
56
56
57
- # Rails 6.1 removes config from ./activerecord/lib/active_record/test_fixtures.rb
58
- if respond_to? ( :config )
59
- config . include mod
60
- else
61
- ActiveRecord ::Base . include mod
62
- end
57
+ ActiveRecord ::Base . include mod
63
58
64
59
group . class_exec do
65
60
let ( :my_helper ) { "my_value" }
You can’t perform that action at this time.
0 commit comments