rspec/rspec-core — Issue #506: Modules included in example groups aren't visible in Ruby 1.9.3
Author: garybernhardt
Created: 2011-11-18 23:56:55+00:00
State: open

In Ruby 1.9.3, when including a module in an example group, constants defined in the module aren't in scope:

module X
module Y
def self.a_method
5
end
end
end

describe X::Y do
include X

it "can access Y" do
Y.a_method.should == 5
end
end

This fails with "NameError: uninitialized constant Y".

This worked fine in 1.9.2, so it seemed like a Ruby change caused the regression. It happens both with rspec-core 2.6.0 and 2.7.1.