# Transactional/Rollback problems

**URL:** <https://www.ruby-forum.com/t/transactional-rollback-problems/122862>\
**Category:** RSpec\
**Created:** [December 12, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/transactional-rollback-problems/122862 "2007-12-12T18:59:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sthorpe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e36b37/32.png) [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Post date:** [December 12, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/transactional-rollback-problems/122862/1 "2007-12-12T18:59:30Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![sthorpe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e36b37/32.png) [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Post date:** [December 12, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/transactional-rollback-problems/122862/2 "2007-12-12T19:27:15Z")

</div>

Rolling back to revision 3131 seems to have fixed the problem. I see  
that 3132 has the following commit message:

“Tighter integration with Test::Unit for ActiveRecord fixtures. Speed  
up fixtures.”

Scott

---

<div class="post-metadata">

**Author:** ![sthorpe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e36b37/32.png) [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Post date:** [December 12, 2007, 9:39pm UTC](https://www.ruby-forum.com/t/transactional-rollback-problems/122862/3 "2007-12-12T21:39:09Z")

</div>

On Dec 11, 2007 2:56 PM, Scott T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Rolling back to revision 3131 seems to have fixed the problem. I see that  
> 3132 has the following commit message:
> 
> “Tighter integration with Test::Unit for ActiveRecord fixtures. Speed up  
> fixtures.”

You mind filing that in the lighthouse?

---

<div class="post-metadata">

**Author:** ![sthorpe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e36b37/32.png) [@sthorpe](https://www.ruby-forum.com/u/sthorpe)\
**Post date:** [December 12, 2007, 11:13pm UTC](https://www.ruby-forum.com/t/transactional-rollback-problems/122862/4 "2007-12-12T23:13:55Z")

</div>

On Dec 11, 2007, at 4:16 PM, David C. wrote:

> > fixtures."
> 
> You mind filing that in the lighthouse?

will do it right now.

Scott
