Created
June 10, 2013 12:16
-
-
Save latentflip/5748310 to your computer and use it in GitHub Desktop.
Testing Puts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
def initialize(word) | |
@word = word | |
end | |
def putter | |
puts @word | |
end | |
end | |
describe "MyClass" do | |
it "should put 'foo'" do | |
myobj = MyClass.new('foo') | |
myobj.should_receive(:puts).with('foo') | |
myobj.putter | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notably,
puts
is not mixed into ruby 1.9's BasicObject, so if you try to do this:You'll get:
Which is kinda confusing, till you remember puts is just a method on your object, and BasicObject is a very bare object so has no puts.