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

Luke Redpath luke at agileevolved.com
Mon Jul 10 03:48:30 EDT 2006


+1 here. Much nicer.

Cheers
Luke

On 10 Jul 2006, at 04:02, David Chelimsky wrote:

> On 7/9/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?
>
>
> I haven't looked at the patch yet, but the ability certainly seems
> nicer than defining helper methods in the setup block.
>
>
>>
>> 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
>>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel



More information about the Rspec-devel mailing list