Created
July 10, 2014 19:43
-
-
Save dholdren/01df15ce88de21727ff6 to your computer and use it in GitHub Desktop.
RSpec hack
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
#solution for "Get this code to pass RSpec" | |
require 'rspec' | |
class Object | |
def should(*args);end | |
def should_not(*args);end | |
def method_missing(method,*args) | |
if method == :upcase | |
Object.new | |
else | |
super | |
end | |
end | |
end | |
class SomeClass | |
def initialize(*args); end | |
end | |
describe 'Foo' do | |
it "should always be true" do | |
1.should == 2 | |
1.should == "a" | |
1.should_not == "a" | |
1.upcase.should == 3 | |
SomeClass.new.should be_true | |
SomeClass.new('foobar').should be_true | |
SomeClass.new('foobar').should be_false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment