mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00

* Initial work on Sidekiq::Config * Initial work on Sidekiq::Config * reduce dependencies in deploy marks * bare sidekiq and webapp * Modify runtime to work with Capsules * Cleanup * Rename test files to remove test_ prefix * Update test suite and standard rules to be more compliant * Move constant definition outside code, per standard formatting * Loads of changes for introduction of Capsules * Remove Redis adapter abstraction * update capsule overview * Ensure Sidekiq.redis uses the correct pool for jobs running within a Capsule * Use default_capsule for safety * Slow down the beat to halve its Redis overhead * move config fixtures into cfg/ * Add capsule middleware test * use accessor
62 lines
1.6 KiB
Ruby
62 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "helper"
|
|
require_relative "dummy/config/environment"
|
|
require "rails/generators/test_case"
|
|
require "generators/sidekiq/job_generator"
|
|
|
|
class JobGeneratorTest < Rails::Generators::TestCase
|
|
tests Sidekiq::Generators::JobGenerator
|
|
destination File.expand_path("../../tmp", __FILE__)
|
|
setup :prepare_destination
|
|
|
|
setup do
|
|
# TODO what's the proper way to silence the generator output?
|
|
Rails.logger.level = Logger::WARN
|
|
end
|
|
|
|
test "all files are properly created" do
|
|
run_generator ["foo"]
|
|
assert_file "app/sidekiq/foo_job.rb"
|
|
assert_file "test/sidekiq/foo_job_test.rb"
|
|
end
|
|
|
|
test "gracefully handles extra job suffix" do
|
|
run_generator ["foo_job"]
|
|
assert_no_file "app/sidekiq/foo_job_job.rb"
|
|
assert_no_file "test/sidekiq/foo_job_job_test.rb"
|
|
|
|
assert_file "app/sidekiq/foo_job.rb"
|
|
assert_file "test/sidekiq/foo_job_test.rb"
|
|
end
|
|
|
|
test "respects rails config test_framework option" do
|
|
Rails.application.config.generators do |g|
|
|
g.test_framework false
|
|
end
|
|
|
|
run_generator ["foo"]
|
|
|
|
assert_file "app/sidekiq/foo_job.rb"
|
|
assert_no_file "test/sidekiq/foo_job_test.rb"
|
|
ensure
|
|
Rails.application.config.generators do |g|
|
|
g.test_framework :test_case
|
|
end
|
|
end
|
|
|
|
test "respects rails config test_framework option for rspec" do
|
|
Rails.application.config.generators do |g|
|
|
g.test_framework :rspec
|
|
end
|
|
|
|
run_generator ["foo"]
|
|
|
|
assert_file "app/sidekiq/foo_job.rb"
|
|
assert_file "spec/sidekiq/foo_job_spec.rb"
|
|
ensure
|
|
Rails.application.config.generators do |g|
|
|
g.test_framework :test_case
|
|
end
|
|
end
|
|
end
|