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

David Chelimsky dchelimsky at gmail.com
Mon Jan 18 10:12:49 EST 2010


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.

FWIW,
David



>
> Also, in general, I think specs look better without ? symbols on methods, my preference though
>
> Ashley
>
> --
> http://www.patchspace.co.uk/
> http://www.linkedin.com/in/ashleymoran
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list