[rspec-devel] [ rspec-Bugs-6570 ] rSpec on Rails does not clean the test DB inbetween contexts

noreply at rubyforge.org noreply at rubyforge.org
Wed Nov 8 15:35:26 EST 2006


Bugs item #6570, was opened at 2006-11-08 12:45
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6570&group_id=797

Category: rails plugin
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Timm Gebhart (onkeltimm)
>Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: rSpec on Rails does not clean the test DB inbetween contexts

Initial Comment:
Version:
RSpec-0.7.0 (r1039)

When I set up a context and load fixtures, those are not removed from the test DB before the next context is run, like this:

# This runs fine
context "Context with fixtures" do
  fixtures :tests

  specify "should have records" do
    Test.find(:all).should_not_be_empty
  end
end

# This fails
context "Context w/o fixtures" do
  specify "should have no records" do
    Test.should_have(:no).records
  end
end

The Test DB should be clean upon entering a context.

----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2006-11-08 15:35

Message:
This is by design in Rails. You would get the same behaviour if you used Test::Unit

Just put fixtures :tests in the other context too. Or put it in the spec_helper.rb

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6570&group_id=797


More information about the rspec-devel mailing list