Skip to content

Commit

Permalink
Merge pull request sidekiq#2019 from dlackty/generator-test
Browse files Browse the repository at this point in the history
Add generator test
  • Loading branch information
seuros committed Oct 21, 2014
2 parents b3e1486 + defbd6a commit 9db4f00
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ coverage/
vendor/
.bundle/
.sass-cache/
tmp/
4 changes: 2 additions & 2 deletions test/test_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class TestCli < Sidekiq::Test
end

it 'does not boot rails' do
refute defined?(::Rails)
refute defined?(::Rails::Application)
@cli.parse(['sidekiq', '-r', './myapp'])
refute defined?(::Rails)
refute defined?(::Rails::Application)
end

it 'changes concurrency' do
Expand Down
17 changes: 17 additions & 0 deletions test/test_worker_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'helper'
require 'rails/generators/test_case'
require 'generators/sidekiq/worker_generator'

class WorkerGeneratorTest < Rails::Generators::TestCase
tests Sidekiq::Generators::WorkerGenerator
arguments %w(foo)
destination File.expand_path("../tmp", File.dirname(__FILE__))
setup :prepare_destination

test "worker is created and its test" do
run_generator

assert_file "app/workers/foo_worker.rb"
assert_file "test/workers/foo_worker_test.rb"
end
end

0 comments on commit 9db4f00

Please sign in to comment.