method

puts

v1_9_2_180 - Show latest stable - Class: Kernel
puts(*args)
public

Equivalent to

$stdout.puts(obj, ...)

1Note

Mocking puts from RSpec

ruuzo ยท Oct 22, 20081 thank

If you want to mock calls to puts from RSpec, do it from the class/module you are in:

module Foo
def self.foo
  puts "hello"
end
end

describe Foo do
it "should write 'hello' when foo() is called" do
  Foo.should_receive(:puts).with("hello")  # Kernel and Object don't work in this case...
  Foo.foo
end
end