Afficher un message
Vieux 08/01/2008, 05h01   #3
jwmerrill@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: More loosely typed expression

On Jan 7, 7:25 pm, Oliver Saunders <oliver.saund...@gmail.com> wrote:
> I'm just trying out RSpec with some really simple code. I have this
> line:
>
> @subject.num(0).fizz?.should == false
>
> And I want it to pass if it's false OR nil. I tried using =~ but it made
> no difference. Is there no way to do this in Ruby?
> --
> Posted viahttp://www.ruby-forum.com/.


This doesn't exactly answer your question, but isn't it unusual to
have a method suffixed with a ? that doesn't return a boolean value?
Anyway, here's a solution:

@subject.num(0).fizz?.should_not be

Regards,

Jason
  Réponse avec citation
 
Page generated in 0,04431 seconds with 9 queries