rspec/rspec-core — Issue #487: Using defined?(Some::Nested::Error) in a method referenced by a rescue clause causes spec suite to abruptly exit on 1.8.7
Author: myronmarston
Created: 2011-10-29 05:41:28+00:00
State: open

This is very bizarre:

``` ruby
describe "weird RSpec issue" do
def expected_error
defined?(::Some::OtherError) ? ::Some::OtherError : ArgumentError
end

it 'wrongly passes and forces the test suite to exit' do
begin
raise "boom"
rescue expected_error
end
end

it 'never runs this spec' do
raise "it never gets here"
end
end
```

``` shell
✗ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]
✗ rspec --version
2.7.1
✗ rspec weird_spec.rb --format doc

weird RSpec issue

Finished in 0.08363 seconds
1 example, 0 failures
```