[rspec-users] Transactional/Rollback problems

Scott Taylor mailing_lists at railsnewbie.com
Tue Dec 11 15:06:39 EST 2007


I'm having a rollback problem with rspec trunk.  It doesn't seem like  
rollbacks are happening quite as often as they should be.   It  
appears as though the rollbacks are *NOT* occurring on the first  
description block in a file, but are for the rest.  Here is a set of  
specs that are failing:

require File.dirname(__FILE__) + "/../spec_helper"

describe "Rollback issue 1" do
   before :each do
     create_user
   end

   it "should have 1 user" do
     User.count.should == 1
   end
end

describe "Rollback issue 2" do
   before :each do
     create_user
   end

   it "should have one user" do
     User.count.should == 1
   end
end
end

escher: rake db:test:prepare
(in /Users/smt/src/web/urbis/trunk)
escher: ./script/spec spec/models/no_rollback_issue_spec.rb
.F

1)
'Rollback issue 2 should have one user 
(Spec::Rails::Example::ModelExampleGroup::Subclass_2)' FAILED
expected: 1,
      got: 2 (using ==)
./spec/models/no_rollback_issue_spec.rb:19:
./script/spec:4:

Finished in 0.343708 seconds

2 examples, 1 failure


But, commenting out the user creation if the first description block  
allows the test to pass:

escher: rake db:test:prepare; ./script/spec spec/models/ 
no_rollback_issue_spec.rb
(in /Users/smt/src/web/urbis/trunk)
..

Finished in 0.236502 seconds

2 examples, 0 failures


I've noticed that at the start of the test log, these two lines are  
seen:

Dec 11 14:56:20 urbis[2166]:  
Spec::Rails::Example::HelperBehaviourController: missing default  
helper path spec/rails/example/helper_behaviour_helper
Dec 11 14:56:20 urbis[2166]:  
Spec::Rails::Example::ViewExampleGroupController: missing default  
helper path spec/rails/example/view_example_group_helper

Don't know if these are related or not.

Any feedback or help would be much appreciated,

Scott

(At trunk /rev. 3135 of rspec, rspec_on_rails,  rails v. 1.2.3, Mac  
OS X.4.11)



More information about the rspec-users mailing list