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

Jeroen Houben jeroen.houben at lostboys.nl
Mon Dec 17 09:23:54 EST 2007


 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)

1)
'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:in `fail_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:in `run_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:in `run_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:in `timeout'
/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:in `execute_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:in `execute_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:in `run'
/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:in `run'
/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:in `run'
./script/spec:4:

Finished in 0.391897 seconds

25 examples, 1 failure, 1 pending


On 12/17/07 3:17 PM, "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.
>> 
> 
> stack trace please
> 
>> 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