I am currently running miniskirt and minitest in a very basic rails 3.2 app. The problem I am having is that if I declare two "it" tests within the same "describe" clause the miniskirt data in the setup method gets created twice. I am using the setup outlined by Ryan Bates in episode #327.
def setup
@res_a = Factory(:reservation)
@res_b = Factory(:reservation)
end
When I run the test using rake test. I get a total count of 2 reservations on the first test and then a count of 4 on the second test.
Any ideas?
UPDATE:
Here is an example of the tests I am running
it "should return all reservations for a given date" do
Reservation.for_date(Time.mktime(2012, 1, 1)).all.count.must_equal 2
end
If I run the test above in two different it methods then the second one fails because the actual count is 4. So it seems to me that Miniskirt is not rolling back the database between tests.
If using "describe", use before and after:
http://old.rspec.info/documentation/before_and_after.html
=== Specs
https://github.com/seattlerb/minitest