Skip to content

Instantly share code, notes, and snippets.

@oleander
Created March 8, 2011 19:34
Show Gist options
  • Save oleander/860858 to your computer and use it in GitHub Desktop.
Save oleander/860858 to your computer and use it in GitHub Desktop.
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