[rspec-devel] [ rspec-Bugs-11091 ] mock setup fails in before(:all), but succeeds in before(:each)

noreply at rubyforge.org noreply at rubyforge.org
Thu May 24 07:26:16 EDT 2007


Bugs item #11091, was opened at 2007-05-24 13:26
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11091&group_id=797

Category: mock module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jon Egil Strand (jonegil)
Assigned to: Nobody (None)
Summary: mock setup fails in before(:all), but succeeds in before(:each)

Initial Comment:


The attached spec shows how setting up a mock fails inconsistently.

When setting it up within before(:all), it fails.
When setting it up within before(:each), it is ok.
When setting it up within before(:each), then within before(:all), both are ok.


Parsing data
- before(:all) (ERROR - 1)

Parsing data
- should include 10 persons (ERROR - 2)

Parsing data
- should include 10 persons (ERROR - 3)

1)
NoMethodError in 'Parsing data before(:all)'
undefined method `add' for nil:NilClass
./test\spec_bug.rb:5:

2)
Spec::Mocks::MockExpectationError in 'Parsing data should include 10 persons'
Mock 'gui' expected :increment with (any args) once, but received it 0 times
./test\spec_bug.rb:18:

3)
Spec::Mocks::MockExpectationError in 'Parsing data should include 10 persons'
Mock 'gui' expected :increment with (any args) once, but received it 0 times
./test\spec_bug.rb:31:

Finished in 0.06 seconds

3 examples, 3 failures

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=11091&group_id=797


More information about the rspec-devel mailing list