Why is "rake tests" running an empty suite when I use shoulda?

Posted by ryeguy on Stack Overflow See other posts from Stack Overflow or by ryeguy
Published on 2010-03-31T23:02:24Z Indexed on 2010/04/01 0:43 UTC
Read the original article Hit count: 364

Filed under:
|
|

So here is my test suite:

class ReleaseTest < ActiveSupport::TestCase
  should_not_allow_values_for :title, '', 'blah', 'blah  blah'
  should_allow_values_for :title, 'blah - bleh', 'blah blah - bleh bleh'
  def test_something
    assert true
  end
end

Shoulda's macros generate 5 tests, and then I have test_something below (just to see if that would matter), totalling 6 tests. They all pass as you can see below, but then it runs a 0-test suite. This happens even if I completely empty out ReleaseTest. This problem only exists if I have config.gem 'shoulda' in my environment.rb. If I explicitly do require 'shoulda' at the top of my tests, everything works fine. What would be causing this?

/usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /var/lib/gems/1.9.1/bin/rake test
Testing started at 6:58 PM ...
(in /home/rlepidi/projects/rails/testproject)
/usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/release_test.rb" 

Loaded suite /var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
......
Finished in 0.029335778 seconds.
6 tests, 6 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

/usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"  
/usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"  

Loaded suite /var/lib/gems/1.9.1/bin/rake
Started
Finished in 0.000106717 seconds.
0 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
Empty test suite.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby