Change in isolation behaviour 1.08 - 1.10?

Hi,

I just moved from 1.08 to 1.10 and now have one example failing, which,
under 1.08, passed. Is the due to a change in behaviour?

Here’s my spec (removed some passing examples)

require File.dirname(FILE) + ‘/…/spec_helper’

describe “A user” do

before(:each) do
@user = User.new
@valid_user = User.new(
:email => ‘[email protected]’,
:fname => ‘bert’,
:lname => ‘valid’,
:jobtitle => “programmer”
)
end

it “should have a unique email address” do
@valid_user.save.should == true
@user.email = @valid_user.email
@user.should have(1).error_on(:email)
end

it “should allow two users with the same name” do
@valid_user.save.should == true
@user.fname = @valid_user.fname
@user.lname = @valid_user.lname
@user.should have(:no).error_on(:fname)
@user.should have(:no).error_on(:lname)
end

end

The second example now fails, as the inserted record from the first
example
is not rolled back.

I can just put a User.delete_all in an after(:each) block but I think it
would be nicer if Rspec wrapped each example in a db transaction. Wasn’t
this they way things worked in 1.08 ?

Jeroen

On Dec 17, 2007 2:13 PM, Jeroen H. [email protected]
wrote:

it “should have a unique email address” do
@user.should have(:no).error_on(:lname)
end

end

The second example now fails, as the inserted record from the first example
is not rolled back.

stack trace please

jeroen$ ./script/spec spec/models/user_spec.rb -b
…F…P…

Pending:
A valid user should add the correct error on dob when using an bogus dob
assignment (with only a month) (met max dob is beetje lastig op win32
lijkt
het :-s)

‘A user should allow two users with the same name’ FAILED
expected: true,
got: false (using ==)
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/expectations.rb:52:i
n fail_with' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/matchers/operator_ma tcher.rb:46:infail_with_message’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/matchers/operator_ma
tcher.rb:56:in __delegate_method_missing_to_target' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/matchers/operator_ma tcher.rb:12:in==’
./spec/models/user_spec.rb:36:
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_meth
ods.rb:79:in instance_eval' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_meth ods.rb:79:inrun_with_description_capturing’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/matchers.rb:144:in
capture_generated_description' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_meth ods.rb:78:inrun_with_description_capturing’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_meth
ods.rb:19:in execute' /usr/local/lib/ruby/1.8/timeout.rb:48:intimeout’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_meth
ods.rb:16:in execute' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_grou p_methods.rb:280:inexecute_examples’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_grou
p_methods.rb:279:in each' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_grou p_methods.rb:279:inexecute_examples’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/example/example_grou
p_methods.rb:120:in run' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/runner/example_group _runner.rb:22:inrun’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/runner/example_group
_runner.rb:21:in each' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/runner/example_group _runner.rb:21:inrun’
/Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/runner/options.rb:87
:in run_examples' /Users/jeroen/lostboys.nl/vendor/plugins/rspec/lib/spec/runner/command_line. rb:19:inrun’
./script/spec:4:

Finished in 0.391897 seconds

25 examples, 1 failure, 1 pending

On Dec 17, 2007 8:47 AM, aslak hellesoy [email protected]
wrote:

end
@user.lname = @valid_user.lname
I don’t see a fixtures :users in your spec. Do you have this in your
spec_helper?
Have you rerun script/generate rspec after you upgraded? There are
some changes in the spec_helper.rb file between the two releases.

This is actually a regression in 1.1.0 that has been fixed in trunk.
We’ll do a 1.1.1 release later today, but go ahead and update to trunk
for the time being and you should be good.

Cheers,
David

On Dec 17, 2007 2:13 PM, Jeroen H. [email protected]
wrote:

it “should have a unique email address” do
@user.should have(:no).error_on(:lname)
end

end

The second example now fails, as the inserted record from the first example
is not rolled back.

I don’t see a fixtures :users in your spec. Do you have this in your
spec_helper?
Have you rerun script/generate rspec after you upgraded? There are
some changes in the spec_helper.rb file between the two releases.

Aslak

On Dec 17, 2007 8:52 AM, Jeroen H. [email protected]
wrote:

This is actually a regression in 1.1.0 that has been fixed in trunk.
We’ll do a 1.1.1 release later today, but go ahead and update to trunk
for the time being and you should be good.

Great, thanks. Will I get 1.1.1 automatically if I’m using svn:externals and
the CURRENT tag?

When we do the release, yes, but not until then.

This is actually a regression in 1.1.0 that has been fixed in trunk.
We’ll do a 1.1.1 release later today, but go ahead and update to trunk
for the time being and you should be good.

Great, thanks. Will I get 1.1.1 automatically if I’m using svn:externals
and
the CURRENT tag?

jeroen

I don’t see a fixtures :users in your spec. Do you have this in your
spec_helper?

Not using fixtures in this particular spec

Have you rerun script/generate rspec after you upgraded?

Yes, but manually copied over the changes in spec_helper.rb

There are some changes in the spec_helper.rb file between the two releases.

… Just received the message by David. This will be fixed in 1.1.1

Thanks for your help!

Jeroen

… Just received the message by David. This will be fixed in 1.1.1

Jeroen - just for good measure, would you kindly update from trunk and
verify that it does in fact fix your issue?

Finished in 3.42683 seconds

176 examples, 0 failures, 3 pending

:slight_smile:

On Dec 17, 2007 8:55 AM, Jeroen H. [email protected]
wrote:

There are some changes in the spec_helper.rb file between the two releases.

… Just received the message by David. This will be fixed in 1.1.1

Jeroen - just for good measure, would you kindly update from trunk and
verify that it does in fact fix your issue?

On Dec 17, 2007 9:06 AM, Jeroen H. [email protected]
wrote:

… Just received the message by David. This will be fixed in 1.1.1

Jeroen - just for good measure, would you kindly update from trunk and
verify that it does in fact fix your issue?

Finished in 3.42683 seconds

176 examples, 0 failures, 3 pending

Thanks. I’ll get the release out by tonight.

Cheers,
David

On Dec 17, 2007 10:55 AM, aslak hellesoy [email protected]
wrote:

176 examples, 0 failures, 3 pending

Thanks. I’ll get the release out by tonight.

Awesome David.

Do we have any specs that will catch this regression if it’s reintroduced?

I didn’t look and don’t have time right now. The fix was committed in
r3158. Can you check the diff?

On Dec 17, 2007 4:12 PM, David C. [email protected] wrote:

Thanks. I’ll get the release out by tonight.

Awesome David.

Do we have any specs that will catch this regression if it’s
reintroduced?

Aslak

On Dec 17, 2007 5:58 PM, David C. [email protected] wrote:

r3158. Can you check the diff?

I’ve added some more functional specs (r3172) that should prevent any
transaction related bugs from coming back in.

Jeroen - if you find more bugs, please report what Rails and Ruby
versions you are using - it took me a while to realise that you were
on Rails 1.2.3 (David told me)

On 12/17/07 7:14 PM, “aslak hellesoy” [email protected] wrote:

Finished in 3.42683 seconds
I didn’t look and don’t have time right now. The fix was committed in
r3158. Can you check the diff?

I’ve added some more functional specs (r3172) that should prevent any
transaction related bugs from coming back in.

Jeroen - if you find more bugs, please report what Rails and Ruby
versions you are using - it took me a while to realise that you were
on Rails 1.2.3 (David told me)

Don’t know if it makes a difference, but I was on 1.2.6

Cheers,

Jeroen

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs