test/cases/active_job_test.rb in minitest-spec-rails-5.4.0 vs test/cases/active_job_test.rb in minitest-spec-rails-5.5.0
- old
+ new
@@ -1,44 +1,46 @@
require 'test_helper'
if defined?(ActiveJob)
-class MyJob < ActiveJob::Base ; def perform(record) ; true ; end end
-class TrashableCleanupJob < MyJob ; end
-
-class ActiveJobTest < MiniTestSpecRails::TestCase
-
- it 'matches spec type for class constants' do
- assert_job MiniTest::Spec.spec_type(MyJob)
- assert_job MiniTest::Spec.spec_type(TrashableCleanupJob)
+ class MyJob < ActiveJob::Base
+ def perform(_record)
+ true
+ end
end
-
- it 'matches spec type for strings' do
- assert_job MiniTest::Spec.spec_type("WidgetJob")
- assert_job MiniTest::Spec.spec_type("WidgetJobTest")
- assert_job MiniTest::Spec.spec_type("Widget Job Test")
- # And is case sensitive
- refute_job MiniTest::Spec.spec_type("widgetmailer")
- refute_job MiniTest::Spec.spec_type("widgetmailertest")
- refute_job MiniTest::Spec.spec_type("widget mailer test")
+ class TrashableCleanupJob < MyJob
end
- it 'wont match spec type for non space characters' do
- refute_job MiniTest::Spec.spec_type("Widget Job\tTest")
- refute_job MiniTest::Spec.spec_type("Widget Job\rTest")
- refute_job MiniTest::Spec.spec_type("Widget Job\nTest")
- refute_job MiniTest::Spec.spec_type("Widget Job\fTest")
- refute_job MiniTest::Spec.spec_type("Widget JobXTest")
- end
+ class ActiveJobTest < MiniTestSpecRails::TestCase
+ it 'matches spec type for class constants' do
+ assert_job MiniTest::Spec.spec_type(MyJob)
+ assert_job MiniTest::Spec.spec_type(TrashableCleanupJob)
+ end
+ it 'matches spec type for strings' do
+ assert_job MiniTest::Spec.spec_type('WidgetJob')
+ assert_job MiniTest::Spec.spec_type('WidgetJobTest')
+ assert_job MiniTest::Spec.spec_type('Widget Job Test')
+ # And is case sensitive
+ refute_job MiniTest::Spec.spec_type('widgetmailer')
+ refute_job MiniTest::Spec.spec_type('widgetmailertest')
+ refute_job MiniTest::Spec.spec_type('widget mailer test')
+ end
- private
+ it 'wont match spec type for non space characters' do
+ refute_job MiniTest::Spec.spec_type("Widget Job\tTest")
+ refute_job MiniTest::Spec.spec_type("Widget Job\rTest")
+ refute_job MiniTest::Spec.spec_type("Widget Job\nTest")
+ refute_job MiniTest::Spec.spec_type("Widget Job\fTest")
+ refute_job MiniTest::Spec.spec_type('Widget JobXTest')
+ end
- def assert_job(actual)
- assert_equal ActiveJob::TestCase, actual
- end
+ private
- def refute_job(actual)
- refute_equal ActiveJob::TestCase, actual
- end
+ def assert_job(actual)
+ assert_equal ActiveJob::TestCase, actual
+ end
-end
+ def refute_job(actual)
+ refute_equal ActiveJob::TestCase, actual
+ end
+ end
end