[rspec-devel] Ruby 1.9 and constant lookup rules

David Chelimsky dchelimsky at gmail.com
Wed Dec 31 17:44:11 EST 2008

Hey all,

I've been working on getting rspec to run with Ruby 1.9. One
significant problem is that 1.9 changes constant lookup rules, so:

module Foo
  module Bar
    describe Thing do

      class Something; end
      def helper_method; end

      it "does not automatically get access to the context of Foo::Bar"
      it "does not automatically get access to Something"
      it "does not automatically get access to helper_method"


Matthias Hennemeyer offered up a patch to resolve this:


I've merged this into the master branch and cleaned things up a bit,
but it only supports top-level calls to #describe. I've been working
on a solution to extract the code in Matthias' patch so that it is
accessible from the top level and nested describe calls, but as I'm
doing this, I grow concerned w/ performance impacts. For this to work,
for every level of nesting there needs to be another call to
instance_eval (at least that's how it works in the current solution).

Anybody have any thoughts about this? Or perhaps a different solution
(like having method_missing delegate to the group)?


More information about the rspec-devel mailing list