[rspec-devel] Feedback on article

Nick Sieger nicksieger at gmail.com
Tue Jan 2 12:36:38 EST 2007


On 1/2/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
>
> That sounds good. We're likely to debate what this API looks like for
> a while, because we only get one shot at it ;-) Here is my initial
> suggestion/example:
>
> Spec::Runner::Context.extend do |context_eval_module|
>   context_eval_module.include StackMethods
> end
>
> class Spec::Runner::Context
>   def self.extend(&block)
>     @@extension_blocks << block
>   end
>
> def initialize(name, &context_block)
>     @name = name
>
>     @context_eval_module = Module.new
>     @context_eval_module.extend ContextEval::ModuleMethods
>     @context_eval_module.include ContextEval::InstanceMethods
>     @@extension_blocks.each{|b| b.call(@context_eval_module)}
>     @context_eval_module.class_eval(&context_block)
>   end
> end
>
> WDYT?


That looks great.  I can't imagine it needing to get much more complicated
than that.  I personally wouldn't change a thing.

/Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-devel/attachments/20070102/6d1f930a/attachment-0001.html 


More information about the rspec-devel mailing list