[rspec-users] default to just call the method?

Pat Maddox mailinglists at patmaddox.com
Mon Jan 18 15:33:28 EST 2010


On Jan 18, 2010, at 7:12 AM, David Chelimsky wrote:

> On Mon, Jan 18, 2010 at 9:03 AM, Ashley Moran
> <ashley.moran at patchspace.co.uk> wrote:
>> 
>> On Jan 18, 2010, at 9:31 am, Pat Maddox wrote:
>> 
>>> define_simple_predicate_matcher :rise_from_the_ashes?
>> 
>> As an extension, how about:
>> 
>> define_simple_predicate_matcher :risen_from_the_ashes => :rises_from_the_ashes?
> 
> I'd rather not add a new DSL for the few cases in which we want to
> essentially delegate a predicate. We can already do this with the
> matcher DSL:
> 
> Spec::Matchers.define :risen_from_the_ashes do
>  match {|actual| actual.risen_from_the_ashes?}
> end
> 
> This is better aligned w/ other matchers, more clear as to what it
> does, and isn't much more code.

This was a suggestion for OP to add to his own codebase, not RSpec, if he wanted to make the matcher definition even more concise.

Pat


More information about the rspec-users mailing list