rspec/rspec-core — Issue #522: Stack level too deep errors occuring after adding an extra example
Author: Axsuul
Created: 2011-12-02 22:01:46+00:00
State: open

I'm using `ruby-1.9.3-p0`. My bundle includes

Using rails (3.1.3)
Using rspec-core (2.7.1)
Using rspec-expectations (2.7.0)
Using rspec-mocks (2.7.0)
Using rspec (2.7.0)
Using rspec-rails (2.7.0)

I have this very weird problem occurring in my spec. I have about 5 examples, like so:

```ruby
describe "Example" do
context "when adding stuff" do
it "should do stuff" do
# ...
end

it "..." do
# ...
end
end

context "when doing other stuff" do
it "..." do
# ...
end

it "..." do
# ...
end

it "..." do
# ...
end
end
end
```

However, if I add an extra example, within the `context "when doing other stuff"` block, I get this error

1) Example when adding stuff should do stuff
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# /../../activesupport-3.1.3/lib/active_support/duration.rb:55

2) Example when adding stuff should do stuff
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# /../../activesupport-3.1.3/lib/active_support/core_ext/time/calculations.rb:266

What makes this weird is if I comment out everything within the block like so

```ruby
it "should do stuff" do
# everything commented out
end
```

it still happens. And even if I comment out the new example I added

```ruby
it "new example within when doing stuff context" do
# everything commented out
end
```

it still throws the error as well. **And then, if I comment out all the code within each example, it still happens!** Only if I remove the first `it "should do stuff"` example entirely, it goes away.

When running all specs like so:

rspec

All my examples pass and run with no stack overflow occuring. However, it's only if I run the spec by file is when the error occurs:

rspec spec/models/example_spec.rb

Has anyone experienced this? Thanks.