[rspec-users] Using Predicates to look at an array..
dchelimsky at gmail.com
Thu Oct 4 13:23:05 EDT 2007
On 10/4/07, Geoffrey Wiseman <geoffrey.wiseman at gmail.com> wrote:
> On 10/4/07, Eric Pugh <epugh at opensourceconnections.com> wrote:
> > shipping_type.should
> This is what I usually do; I agree the syntax of be_include looks odd, as is
> true for some other predicates.
> OTOH, it's hard to find a formulation that works well for all predicates.
> For instance:
> domain.should_valid doesn't look as good as domain.should be_valid
> domain.should_include(x) looks better than domain.should be_include(x)
> Rspec could support both, which means you could select the one that "looks"
> right, I guess. That might lead to inconsistent usage. I can live with the
> current approach as well, looks odd, but it's not a serious problem for me.
As Nick points out in this thread, rspec supports:
Also, you can define your own predicate matchers very easily using the
predicate_matchers[:be_able_to_cook] = [:can_cook?]
=> passes if chef.can_cook?
> - Geoffrey
> Geoffrey Wiseman
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users