mysql timeout error in rails 3 when using delete_all and make! in step definition
I'm using following construct in a cucumber step definition.
Given "I have following stuff" do
Model.delete_all
list.each { |i| Model.make!(:name => i) }
end
(make! is from machinist 2).
Above step fails with INSERT state开发者_开发知识库ment timeout. When I open up a console for test, environment, I can execute each statement without an issue. Also, if I disable transactional features timeout goes away.
Can anyone please help me fix this? (This ran without an issue with rails 2.x)
(Database MySQL)
This turned out be an issue with machinist beta version I was using. I'm not 100% sure what was wrong, but when I used pure ActiveRecord code to create the objects, instead of make! it worked.
Then I switched to Factory_Girl instead of machinist, and now it works fine.
精彩评论