[rspec-users] Change in isolation behaviour 1.08 - 1.10 ?

David Chelimsky dchelimsky at gmail.com
Mon Dec 17 09:50:33 EST 2007


On Dec 17, 2007 8:47 AM, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> On Dec 17, 2007 2:13 PM, Jeroen Houben <jeroen.houben at lostboys.nl> wrote:
>
> > 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    => 'bert.valid at lostboys.nl',
> >       :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 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

>
> Aslak
>
>
> > 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
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list