Created
May 23, 2012 00:02
-
-
Save clayallsopp/2772440 to your computer and use it in GitHub Desktop.
This file contains 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
it "instance_eval" do | |
class SomeClass | |
end | |
c = SomeClass.new | |
c.instance_eval do | |
def new_method | |
"test" | |
end | |
end | |
SomeClass.class_eval do | |
def self.another_method | |
"test2" | |
end | |
end | |
c.new_method.should == "test" | |
SomeClass.another_method.should == "test2" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment