Skip to content

Instantly share code, notes, and snippets.

@jnicklas
Created November 10, 2011 07:38
Show Gist options
  • Save jnicklas/1354361 to your computer and use it in GitHub Desktop.
Save jnicklas/1354361 to your computer and use it in GitHub Desktop.
module Foo
Bar = "test"
end
describe "Foo" do
include Foo
it "should be included in this context" do
Bar.should == 'test'
end
end
~/Desktop$ rvm use 1.9.2
Using /Users/jonas/.rvm/gems/ruby-1.9.2-p290
~/Desktop$ rspec test_spec.rb
.
Finished in 1.88 seconds
1 example, 0 failures
~/Desktop$ rvm use 1.9.3
Using /Users/jonas/.rvm/gems/ruby-1.9.3-p0
~/Desktop$ rspec test_spec.rb
F
Failures:
1) Foo should be included in this context
Failure/Error: Bar.should == 'test'
NameError:
uninitialized constant Bar
# ./test_spec.rb:9:in `block (2 levels) in <top (required)>'
Finished in 0.26293 seconds
1 example, 1 failure
Failed examples:
rspec ./test_spec.rb:8 # Foo should be included in this context
@josevalim
Copy link

o.O

What does puts self.class.ancestors on line 9 return?

@sobrinho
Copy link

Same happens with JRuby 1.6.5 o.O

self.class.ancestors returns RSpec::Core::ExampleGroup::Nested_1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment