On Tue, Sep 30, 2008 at 10:38 AM, Ben Mabey <[EMAIL PROTECTED]> wrote:
> David Chelimsky wrote:
>>
>> On Tue, Sep 30, 2008 at 7:59 AM, Zach Dennis <[EMAIL PROTECTED]>
>> wrote:
>>
>>>
>>> Also, a nice thing about RSpec is that when you do describe an actual
>>> object, ie: "describe Foo", you can determine this by asking the
>>> example group what it's described type is.
>>>
>>> This makes things a lot simpler and cleaner than having to hack away
>>> strings, or guess based on the name of your test.
>>>
>>> Zach
>>>
>>> On Tue, Sep 30, 2008 at 8:57 AM, Zach Dennis <[EMAIL PROTECTED]>
>>> wrote:
>>>
>>>>
>>>> On Tue, Sep 30, 2008 at 8:41 AM, Andy Freeman <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>>>
>>>>> Are you willing to provide a simple example?
>>>>>
>>>>
>>>> I'm using the same example as the articled you linked to originally as
>>>> the base. This way you should be able to clearly see the differences.
>>>>
>>>> http://gist.github.com/13804
>>>>
>>
>> Here's a variation on that with a helper for defining macros that I'm
>> thinking of adding to rspec. Lemme know what you think:
>>
>> http://gist.github.com/13821
>>
>> Cheers,
>> David
>>
>>
>
> +1
> I like it.  For rspec-rails it would also be nice to be able to say:
>
> define_macros(:for => :controller) do
> ...
> end
>
> define_macros(:for => :models) do
> ...
> end
> etc...
>
> Also, instead of yielding within another block you can simply pass in the
> given block as an arg:
>
> def define_macros(&macro_block)
>  Spec::Example::ExampleGroupMethods.extend Module.new(&macro_block)
> end
>
> You probably knew this but I thought I would point it out because it seems
> that it would give you better performance. (I have not tested that
> assumption at all.)
>

I like David's suggestion and I also like Ben's suggestion on top of
it. +1 to both.

-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to