[Rspec-devel] Patch that allows method definitions inside of a context

Lachie lachiec at gmail.com
Sun Jul 9 23:46:00 EDT 2006


+1

Are the methods scoped to the context? Is there a clean way of sharing
them across contexts?

On 7/10/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> Great stuff Brian - you're a metaprogramming whiz!
>
> I'd like to apply this patch, what do you others think?
>
> Aslak
>
> On 7/9/06, Brian Takita <brian.takita at gmail.com> wrote:
> > Hello,
> >
> > I submitted a patch that allows you to define methods inside of the context
> > block rather than inside of the setup method block.
> > http://rubyforge.org/tracker/index.php?group_id=797&atid=3151
> >
> > For example, this patch allows:
> > require File.dirname(__FILE__) + '/../lib/spec'
> >
> > context "Rspec allow you to define custom methods" do
> >  specify "Rspec should allow you to define methods" do
> >
> >  a_method
> >  @a_method_called.should.be true
> >  end
> >
> >  def a_method
> >  @a_method_called = true
> >  end
> > end
> > This patch also does not break the behaviour where methods can be defined
> > inside of the setup block.
> >
> > Thank you,
> > Brian Takita
> >
> > _______________________________________________
> > Rspec-devel mailing list
> > Rspec-devel at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-devel
> >
> >
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


-- 
Lachie
http://lachie.info/
http://www.flickr.com/photos/lachie/


More information about the Rspec-devel mailing list