On 4 Nov 2008, at 11:10, Andrew Premdas wrote:

Is there any way to do

  foo.should (be_nil || be_empty)

in rspec.

That won't do what you want it to, at first glance it will always match with be_nil. You could write a custom matcher (be_nil_or_empty), but I suspect that's not the real answer here.

Why do you want to do this? What is the distinction between nil and empty in your app? I suspect this is a data modelling issue rather than a spec issue. (Be very wary as soon as you see conditionals in your code.)

Ashley


--
http://www.patchspace.co.uk/
http://aviewfromafar.net/



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to