[rspec-users] Apparent regression in rspec 2 on ruby 1.9: constant resolution fails in describes in nested modules

Rhett Sutphin rhett at detailedbalance.net
Fri Nov 5 10:19:11 EDT 2010


Hi,

On Nov 5, 2010, at 7:13 AM, David Chelimsky wrote:

> On Nov 3, 2010, at 5:39 PM, Rhett Sutphin wrote:
> 
>> Hi,
>> 
>> I've converted a couple of my smaller libraries' spec suites to rspec 2 with no trouble.  (I'm enjoying the new version -- thanks to all involved.)  I'm trying to convert one a larger suite now and I've run into two problems on ruby 1.9.1 (but not 1.8.7) related to constant resolution in describes inside of modules.  One of the problems haven't been able to reproduce in a simple test case, but the other one I have.  Here's the reproducible one:
>> 
[details snipped]
>> 
>> Is this a bug or expected behavior in rspec 2?  I'll file an issue if it's a bug -- this would be against rspec-core, correct?
> 
> Same issue just came up on this list yesterday: http://groups.google.com/group/rspec/browse_thread/thread/60cfab923dbf007a

Yeah, those were both me -- I sent the first one from the wrong address.  Sorry about the noise.

To summarize what I've learned for someone who comes across this later:  1.9.1 has some bugs regarding scoping.  While rspec 1.3.x worked around these bugs in some fashion, rspec 2 will not.  (Since 1.9.1 is a superseded revision of the experimental version of ruby, this seems reasonable to me.)  I filed an issue[1] requesting that the non-support of 1.9.1 be noted in the upgrade guide.  Myron Marston helpfully pointed out a workaround for the minimal example I posted -- my actual specs are more complex, but I'm sure there are similar workarounds.  For the particular gem I'm working on (an internal one) dropping support for 1.9.1 in favor of 1.9.2 is a fine option, so I'm doing that instead.

[1]: https://github.com/rspec/rspec-core/issues/209

Thanks for the help,
Rhett

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list