I have a problem with fixtures not being removed between tests and would 
like to know if this is expected behavior or not.

For example, say that I have a model Car, and a car.yml fixtures file. I 
have two test cases CarTest and DealerTest. In the first test,
I want to use fixtures, so I define it like this:

class CarTest< ActiveSupport::TestCase
  fixtures :cars
  
  test "Car fixtures should have been loaded" do
    assert_equal NUMBER_OF_FIXTURES, Car.count
  end
end

In my second test case, DealerTest, I do not want to use the car fixtures, 
but want to create some of my own.
class DealerTest< ActiveSupport::TestCase
  
  test "No Cars should be in the database" do
    assert_equal 0, Car.count
  end
end

Now, if I run this test individually, it works fine. But if I run it using 
*rake 
test:units*, it fails. The car fixtures are left over from the previous 
test. 

Is this how it is supposed to work?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/gYDJXe-hj2sJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to