rspec - A question in the rails spec test -


today, use factory_girl instead of rails fixtures, problem: after run command "spec spec" done, data resets fixtures, can tell me answer?

thank you!

if intend use both factories , fixtures in project , not running them through rake tasks: eg rake spec, need make sure doing removal of values db hand. doing grabbing old record in database , think data being reset. can verify using puts inside spec trace number of records in db.

puts myrecord.count

you can clear values in after or before block.

before(:each)    factory(:my_model) end  after(:each)    mymodel.delete_all end 

if intend use model or factory in other spec files, can add these global before , after blocks in spec helper.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -