Hi, When I test my Rails controller, I find that records created in before(:all) remain in database while records created in before(:each) and let are wiped out after testing. This made me run "rake test:prepare" for every new test. Is that normal? Best regards, Zhi-Qiang Lei zhiqiang.lei@gmail.com
on 2011-11-25 15:59
on 2011-11-25 17:33
Yes, Only before :each is run in transaction. You should avoid creating records in the before :all hook
on 2011-11-25 18:15
On Nov 25, 2011, at 8:04 AM, Zhi-Qiang Lei wrote: > Hi, > > When I test my Rails controller, I find that records created in before(:all) remain in database while records created in before(:each) and let are wiped out after testing. This made me run "rake test:prepare" for every new test. Is that normal? Yes. before(:all) is not run in a transaction.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.