On Aug 4, 2010, at 1:55 AM, Myron Marston wrote:
> Ashley: thanks for posting the example. It's nice to see how this all
> fits together.
>
> Re: RSpec 2 for ruby 1.8.6: I don't see RSpec 2 as being all that
> useful for Rails 2.x projects on ruby 1.8.6. However, it's still very
> important for gems. I just converted one of my projects (VCR[1]) to
> RSpec 2, and VCR supports ruby 1.8.6, 1.8.7 and 1.9.1. If we remove
> ruby 1.8.6 support from RSpec 2, I'd have to migrate back to RSpec 1.x
> so that I can continue to run the spec suite on 1.8.6. I imagine
> there will be plenty of other libraries that will want to upgrade to
> using RSpec 2 after the final release, while still supporting 1.8.6.
>
> Good news: I messed around with module_exec some more, and I think I
> have a working implementation for 1.8.6[2]. This was complicated
> enough that I wanted to work on it in isolation from RSpec; hence the
> separate github project. We'll probably want to re-organize it a bit
> before merging it in, if it's deemed "good enough" to work for our
> needs. It has some specs that pass for module_exec on 1.8.7, and they
> pass on 1.8.6 with my implementation, too. There may be cases where
> it still doesn't work quite right, though--feel free to fork, add
> specs, etc.
Hey Myron - I think what you have is perfectly fine. The only issue I ran into
was that of defining instance methods, and your solution seems sound. I
wouldn't even bother to undef those methods. We're not putting module_exec in
as an API. In fact, in rspec, I think we should change the names of module_exec
and instance_exec to something rspec-specific so that users don't rely on our
implementation for other purposes. Something like:
def module_eval_with_args(*args, &block)
if respond_to?(:module_exec)
module_exec(*args, &block)
else
# custom solution
end
end
At that point, as long as all the shared group specs are passing, we're good.
Make sense?
>
> Myron
>
> [1] http://github.com/myronmarston/vcr
> [2] http://github.com/myronmarston/module_exec
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users