How to verify that "puts" has been called with a certain message?

Posted by soulnafein on Stack Overflow See other posts from Stack Overflow or by soulnafein
Published on 2010-03-29T06:42:34Z Indexed on 2010/03/29 6:43 UTC
Read the original article Hit count: 214

Filed under:
|
|

Hello there. I'm trying to make this test fail :)

it "should display the question" do
  @ui.should_receive(:puts).with("What's your name?").once
  @ui.ask_question("What's your name?")
end

At the moment it passes even if I don't call puts in my function.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about rspec