Re: why database_cleaner doesn''t clean?

Mauro
Thu, 02 Jun 2011 19:08:09 -0000

On 2 June 2011 18:25, Mauro
<mrsanna1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> On 2 June 2011 17:15, radhames brito
<rbritom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Try posting a bit of the test.log to seed what is happening to the db
>
> Sorry I''ve found that the problem is when I run autotest.
> If I run rspec individually for every controller they passes.
> If I run autotest they don''t pass.
> For sector controller test I''ve posted the code, if I run rspec
for it passes.
> If I run autotest it says:
>
> SectorsController GET index assigns all sectors as @sectors
>     Failure/Error: assigns(:sectors).should eq([sector])
>
>       expected [#<Sector id: 2603, name: "Sector-1",
created_at:
> "2011-06-02 18:20:15", updated_at: "2011-06-02
18:20:15">]
>            got [#<Sector id: 2548, name: "Sector-1",
created_at:
> "2011-06-02 18:19:46", updated_at: "2011-06-02
18:19:46">, #<Sector
> id: 2549, name: "Sector-1", created_at: "2011-06-02
18:19:46",
> updated_at: "2011-06-02 18:19:46">, #<Sector id: 2550

In the configuration of database_cleaner I''ve changed
DatabaseCleaner.strategy = :transaction to DatabaseCleaner.strategy :deletion
and when I run autotest now the tests pass.
I''ve to use DatabaseCleaner.strategy = :transaction when I run rspec
individually for every spec and DatabaseCleaner.strategy = :deletion
when I run autotest?

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.