1

I am writing tests for my sidekiq workers and I want them to run when I type "rake" in the terminal. I have that working - I added the following to my Rakefile:

namespace :test do
  Rake::TestTask.new(:workers) do |t|
    t.libs << "test"
    t.pattern = 'test/workers/**/*_test.rb'
  end
end

Rake::Task[:test].enhance ["test:workers"]

When I run rake I get something like this as my output:

Run options: --seed 51172

# Running tests:

SS

Finished tests in 0.005594s, 357.5259 tests/s, 0.0000 assertions/s.

2 tests, 0 assertions, 0 failures, 0 errors, 2 skips
Run options: --seed 17561

# Running tests:

S............................................SSSS..SSSSS......

Finished tests in 2.037526s, 30.4291 tests/s, 45.6436 assertions/s.

62 tests, 93 assertions, 0 failures, 0 errors, 10 skips

The S characters are skips - I haven't finished all of my tests yet. So my question is basically - is there a way to merge the two sets of tests after enhancing? Should I be doing something different than an enhance?

If I'm doing anything blatantly wrong please let me know, and thanks for reading this. And just in case it is needed: Rails 4 w/ Ruby 2.0

joncalhoun
  • 1,498
  • 1
  • 17
  • 22

2 Answers2

1

Try this, change the following:

Rake::TestTask.new(:workers) do |t|

to this:

Rails::TestTask.new(:workers) do |t|

It's a small change, but fixes the problem for me. It means your entire test suite will run with merged output.

stephenmurdoch
  • 34,024
  • 29
  • 114
  • 189
  • 1
    This may or may not work but sadly I can't confirm with the same codebase since it was asked a long time ago. I'll try it on my next project though - thanks! – joncalhoun Aug 07 '14 at 13:39
0

there is a simple workaround for this:

bundle exec rake test:all

if you want to see how rails tasks are created look here

phoet
  • 18,688
  • 4
  • 46
  • 74