Created
March 8, 2011 19:34
-
-
Save oleander/860858 to your computer and use it in GitHub Desktop.
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
require "rubygems" | |
require "rspec" | |
class MyExample | |
def method | |
[1,2,3] | |
end | |
def method_missing(method, *args, &block) | |
send(:method) | |
end | |
end | |
describe "an error" do | |
it "should have 3 cars" do | |
# Fails with error | |
# expected cars to be a collection but it does not respond to #length or #size | |
MyExample.new.should have(3).cars | |
end | |
it "should also have 3 cars" do | |
# Passes | |
MyExample.new.cars.count.should eq(3) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment