Issue #7213 has been updated by shugo (Shugo Maeda).


mame (Yusuke Endoh) wrote:
> I meant your answers in these tickets:
> 
> https://bugs.ruby-lang.org/issues/6838
> https://bugs.ruby-lang.org/issues/5777
> 
> As far as I know, #instance_eval with block changed constant lookup scope in 1.9.2, but it has stopped since 1.9.3.
> The rspec behavior looks affected by this spec change.

In 1.9.2, constant lookup in instance_eval or module_eval had already been reverted to the behavior of 1.8,
but there was a bug (#4536) in 1.9.2, and the bug was fixed in 1.9.3.

So I suspected that the fix of #4536 is related to this issue, but foobar_spec.rb fails even if the fix is reverted.

Anyway, the current behavior is intended.  The following code illustrates why foobar_spec.rb fails in 1.9.3.

  module Foo
   X = 1
  end
  
  o = Object.new
  o.extend(Foo)
  o.instance_eval {
    p X
  }

This code prints 1 in 1.9.2, but raises a NameError in 1.8 and 1.9.3.
I don't know when this bug of 1.9.2 was fixed.
----------------------------------------
Bug #7213: Namespace regression problem in RSpec from 1.9.2 to 1.9.3
https://bugs.ruby-lang.org/issues/7213#change-32545

Author: aef (Alexander E. Fischer)
Status: Rejected
Priority: Normal
Assignee: shugo (Shugo Maeda)
Category: 
Target version: 2.0.0
ruby -v: 1.9.3


This article describes a bug which appeared in 1.9.3: "Including namespace module through RSpec config in Ruby 1.9.3":http://stackoverflow.com/questions/13042298/including-namespace-module-through-rspec-config-in-ruby-1-9-3

Some people believe that it could be related to #3422 which seemed to introduce regression but it wasn't sure if this regression was wanted or not.


-- 
http://bugs.ruby-lang.org/