diff options
author | Matthew Draper <matthew@trebex.net> | 2015-03-30 23:01:16 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-03-30 23:04:25 +1030 |
commit | cb012467214f6e4bb1ac3987554bb75020b4796b (patch) | |
tree | a2b16c15b50bc40da24f2d8d6e03aef88557974f /railties/test | |
parent | e2a96c071216d14659294a5a7645878656c30916 (diff) | |
parent | 929a794a317666e4d29954e4f071c1dd57482aa7 (diff) | |
download | rails-cb012467214f6e4bb1ac3987554bb75020b4796b.tar.gz rails-cb012467214f6e4bb1ac3987554bb75020b4796b.tar.bz2 rails-cb012467214f6e4bb1ac3987554bb75020b4796b.zip |
Merge pull request #19034 from jvanbaarsen/explicit-job-base-class
Add explicit base class for ActiveJob jobs
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake_test.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/job_generator_test.rb | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 2bff21dae5..0648b11813 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -99,7 +99,7 @@ module ApplicationTests end def test_code_statistics_sanity - assert_match "Code LOC: 5 Test LOC: 0 Code to Test Ratio: 1:0.0", + assert_match "Code LOC: 7 Test LOC: 0 Code to Test Ratio: 1:0.0", Dir.chdir(app_path){ `rake stats` } end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 00a7932267..282e8cc4f9 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -18,6 +18,7 @@ DEFAULT_APP_FILES = %w( app/mailers app/models app/models/concerns + app/jobs app/views/layouts bin/bundle bin/rails @@ -67,6 +68,11 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file("app/assets/javascripts/application.js") end + def test_application_job_file_present + run_generator + assert_file("app/jobs/application_job.rb") + end + def test_invalid_application_name_raises_an_error content = capture(:stderr){ run_generator [File.join(destination_root, "43-things")] } assert_equal "Invalid application name 43-things. Please give a name which does not start with numbers.\n", content diff --git a/railties/test/generators/job_generator_test.rb b/railties/test/generators/job_generator_test.rb index a9e0cea94f..7fd8f2062f 100644 --- a/railties/test/generators/job_generator_test.rb +++ b/railties/test/generators/job_generator_test.rb @@ -7,14 +7,14 @@ class JobGeneratorTest < Rails::Generators::TestCase def test_job_skeleton_is_created run_generator ["refresh_counters"] assert_file "app/jobs/refresh_counters_job.rb" do |job| - assert_match(/class RefreshCountersJob < ActiveJob::Base/, job) + assert_match(/class RefreshCountersJob < ApplicationJob/, job) end end def test_job_queue_param run_generator ["refresh_counters", "--queue", "important"] assert_file "app/jobs/refresh_counters_job.rb" do |job| - assert_match(/class RefreshCountersJob < ActiveJob::Base/, job) + assert_match(/class RefreshCountersJob < ApplicationJob/, job) assert_match(/queue_as :important/, job) end end @@ -22,7 +22,7 @@ class JobGeneratorTest < Rails::Generators::TestCase def test_job_namespace run_generator ["admin/refresh_counters", "--queue", "admin"] assert_file "app/jobs/admin/refresh_counters_job.rb" do |job| - assert_match(/class Admin::RefreshCountersJob < ActiveJob::Base/, job) + assert_match(/class Admin::RefreshCountersJob < ApplicationJob/, job) assert_match(/queue_as :admin/, job) end end |