aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/support/integration/test_case_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activejob/test/support/integration/test_case_helpers.rb')
-rw-r--r--activejob/test/support/integration/test_case_helpers.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb
index 8319d09520..fdf25c67a1 100644
--- a/activejob/test/support/integration/test_case_helpers.rb
+++ b/activejob/test/support/integration/test_case_helpers.rb
@@ -1,4 +1,5 @@
require 'active_support/concern'
+require 'active_support/core_ext/string/inflections'
require 'support/integration/jobs_manager'
module TestCaseHelpers
@@ -28,7 +29,8 @@ module TestCaseHelpers
end
def adapter_is?(*adapter_class_symbols)
- adapter_class_symbols.map(&:to_s).include?(ActiveJob::Base.queue_adapter.class.name.split("::").last.gsub(/Adapter$/, '').underscore)
+ adapter = ActiveJob::Base.queue_adapter.class.name.demodulize.chomp('Adapter').underscore
+ adapter_class_symbols.map(&:to_s).include? adapter
end
def wait_for_jobs_to_finish_for(seconds=60)
@@ -42,15 +44,23 @@ module TestCaseHelpers
end
end
+ def job_file(id)
+ Dummy::Application.root.join("tmp/#{id}")
+ end
+
def job_executed(id=@id)
- Dummy::Application.root.join("tmp/#{id}").exist?
+ job_file(id).exist?
+ end
+
+ def job_data(id)
+ Marshal.load(File.binread(job_file(id)))
end
def job_executed_at(id=@id)
- File.new(Dummy::Application.root.join("tmp/#{id}")).ctime
+ job_data(id)["executed_at"]
end
- def job_output
- File.read Dummy::Application.root.join("tmp/#{@id}")
+ def job_executed_in_locale(id=@id)
+ job_data(id)["locale"]
end
end