[rspec-users] RSpec interacting with Test::Unit: weird "is already defined" error

David Chelimsky dchelimsky at gmail.com
Tue Nov 30 13:21:42 EST 2010


On Nov 30, 2010, at 10:28 AM, Jo Liss wrote:

> One more thing: If instead of "test 'something'" I write "def 
> test_something", like so:
> 
> require 'test_helper'
> class FirstTest < ActiveSupport::TestCase
>  def test_something
>    assert_equal 42, 84
>  end
> end
> class SecondTest < ActiveSupport::TestCase
>  def test_something
>    assert_equal 42, 84
>  end
> end
> describe 'this is an rspec test' do
> end
> 
> ... then adding the last two lines causes the two test_something tests 
> to not be picked up at all (so zero tests are run).
> 
> Strange, isn't it?

Hey Jo - welcome to the RSpec list.

RSpec and Test::Unit each have their own runners which work differently, so what you're experiencing is not surprising.

Are you just exploring at this point? Or is there a problem you're trying to solve by intermingling them?

I'd recommend keeping specs under the spec directory and run them separately from Test::Unit tests.




More information about the rspec-users mailing list