1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/generators/job_generator_test.rb
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30

36 lines
1.2 KiB
Ruby

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 < 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 < ApplicationJob/, 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 < ApplicationJob/, job)
assert_match(/queue_as :admin/, job)
end
end
def test_application_job_skeleton_is_created
run_generator ["refresh_counters"]
assert_file "app/jobs/application_job.rb" do |job|
assert_match(/class ApplicationJob < ActiveJob::Base/, job)
end
end
end