Topic: destroy_all in teardown doesn't really flush my table
I have a test (test unit ) using machinist
def setup
Agent.make!
end
def teardown
Agent.destroy_all
puts Agent.count # -> 0
end
test "someting" do
# do nothing
end
The result for Agent.count in teardown is 0 (in test.log I see "DELETE FROM AGENTS"
But a native statement "select count(*) from agents" returns 1.
The problem is that the table is still populated after the test. The next test fails because of duplicate values.
I know, normally the complete DB should be dropped and new created, but the ibm_driver seems not to support that.
So I decided to skip that task in databases.rake and clean my tables after each test.
Since I am new to rails I am not sure, if this is test unit, a db (ibm db2 ) or even a machinist related
gem 'rails', '3.0.0'
gem 'machinist', '>= 2.0.0.beta2'
ruby 1.9.2
gem 'ibm_db'
thanks in advance or any hint