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?