[rspec-users] Can I do foo.should (be_nil || be_empty) in rspec
ashley.moran at patchspace.co.uk
Tue Nov 4 14:14:51 EST 2008
On Nov 04, 2008, at 5:07 pm, David Chelimsky wrote:
> FYI - if you REALLY want to match against either, it's pretty easy to
> do w/ simple matcher:
> def be_nil_or_empty
> simple_matcher "nil? or empty? to return true" do |actual|
> actual.nil? || actual.empty?
Wow, I completely forgot about simple_matcher. That REALLY deserves a
more prominent place in the docs! It's a great feature.
Would be really cool if you could do it like this though:
simple_matcher :be_nil_or_empty, "nil? or empty? to return true" do |
actual.nil? || actual.empty?
and have it call define_method for you.
That's one I could hopefully do myself in time, after I've got a few
Merb/DataMapper jobs out of the way.
WYDAT? Worth filing a ticket for?
More information about the rspec-users