diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-12-08 14:31:37 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-12-08 14:31:37 -0200 |
commit | 78504600f51abe496ce317f6b67ec2baf58f6574 (patch) | |
tree | 088f4dde5df0f7a14b4c88923a167b11fffe408a /railties | |
parent | 6f4fd2c6322342a4189a2a5ebb50a7650c07ae88 (diff) | |
parent | 1bf42df03178d5492e514ccc66208cff35a29ffb (diff) | |
download | rails-78504600f51abe496ce317f6b67ec2baf58f6574.tar.gz rails-78504600f51abe496ce317f6b67ec2baf58f6574.tar.bz2 rails-78504600f51abe496ce317f6b67ec2baf58f6574.zip |
Merge pull request #17953 from kirs/test-activejob-generator
Test coverage for ActiveJob generator
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/job_generator_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/test/generators/job_generator_test.rb b/railties/test/generators/job_generator_test.rb new file mode 100644 index 0000000000..a9e0cea94f --- /dev/null +++ b/railties/test/generators/job_generator_test.rb @@ -0,0 +1,29 @@ +require 'generators/generators_test_helper' +require 'rails/generators/job/job_generator' + +class JobGeneratorTest < Rails::Generators::TestCase + include GeneratorsTestHelper + + 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) + 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(/queue_as :important/, job) + end + end + + 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(/queue_as :admin/, job) + end + end +end |