I have some fixtures set up to put a few records in some of my tables. In some of my rspec describe blocks, i''m *not* calling the fixtures, and expecting the tables to be empty. But they''re not - the fixture data is in there. Am i using fixtures wrongly? I thought that the db was wiped at the start of every test and the fixtures were only added if asked for. Is that not the case? I''m new to rspec and can''t find much about fixtures in the documentation. thanks max -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Are you by any chance running this with a Sqlite db? I am running into the same problem and I vaguely remember that Sqlite does not support transactions. Which is set in my spec_helper.rb. Perhaps that throws Rspec off. With kind regards, Harm On Feb 7, 10:51 am, Max Williams <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have somefixturesset up to put a few records in some of my tables. > In some of myrspecdescribe blocks, i''m *not* calling thefixtures, and > expecting the tables to be empty. But they''re not - the fixture data is > in there. > > Am i usingfixtureswrongly? I thought that the db was wiped at the > start of every test and thefixtureswere only added if asked for. Is > that not the case? I''m new torspecand can''t find much aboutfixtures > in the documentation. > > thanks > max > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Chelimsky
2008-Mar-28 15:37 UTC
Re: rspec fixtures stay in the test db - is this right?
On Thu, Feb 7, 2008 at 5:51 AM, Max Williams <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have some fixtures set up to put a few records in some of my tables. > In some of my rspec describe blocks, i''m *not* calling the fixtures, and > expecting the tables to be empty. But they''re not - the fixture data is > in there. > > Am i using fixtures wrongly? I thought that the db was wiped at the > start of every test and the fixtures were only added if asked for. Is > that not the case? I''m new to rspec and can''t find much about fixtures > in the documentation.RSpec just wraps Rails testing infrastructure, so you should see the same behaviour in rspec or test/unit.> > thanks > max > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams
2008-Mar-28 15:46 UTC
Re: rspec fixtures stay in the test db - is this right?
David Chelimsky wrote:> On Thu, Feb 7, 2008 at 5:51 AM, Max Williams > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> I have some fixtures set up to put a few records in some of my tables. >> In some of my rspec describe blocks, i''m *not* calling the fixtures, and >> expecting the tables to be empty. But they''re not - the fixture data is >> in there. >> >> Am i using fixtures wrongly? I thought that the db was wiped at the >> start of every test and the fixtures were only added if asked for. Is >> that not the case? I''m new to rspec and can''t find much about fixtures >> in the documentation. > > RSpec just wraps Rails testing infrastructure, so you should see the > same behaviour in rspec or test/unit.Hi David You actually answered this question in another mailing list a while ago - it was because my fixture data was being loaded in a before :all rather than before :each - and so couldn''t be rolled back out of existence when the describe block finished. So, every time i ran the test the data was stacking up. Just in case anyone else was wondering (sorry, i should have replied to this post myself once i found the answer). thanks max -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David Chelimsky
2008-Mar-28 15:50 UTC
Re: rspec fixtures stay in the test db - is this right?
On Fri, Mar 28, 2008 at 11:46 AM, Max Williams <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > David Chelimsky wrote: > > On Thu, Feb 7, 2008 at 5:51 AM, Max Williams > > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> > >> I have some fixtures set up to put a few records in some of my tables. > >> In some of my rspec describe blocks, i''m *not* calling the fixtures, and > >> expecting the tables to be empty. But they''re not - the fixture data is > >> in there. > >> > >> Am i using fixtures wrongly? I thought that the db was wiped at the > >> start of every test and the fixtures were only added if asked for. Is > >> that not the case? I''m new to rspec and can''t find much about fixtures > >> in the documentation. > > > > RSpec just wraps Rails testing infrastructure, so you should see the > > same behaviour in rspec or test/unit. > > Hi David > > You actually answered this question in another mailing list a while agoAh - difficult to keep track of who is who sometimes! Glad you got it resolved. Cheers, David> - it was because my fixture data was being loaded in a before :all > rather than before :each - and so couldn''t be rolled back out of > existence when the describe block finished. So, every time i ran the > test the data was stacking up. Just in case anyone else was wondering > (sorry, i should have replied to this post myself once i found the > answer). > > > > thanks > max > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---