Skip to content

Instantly share code, notes, and snippets.

@clayallsopp
Created May 23, 2012 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayallsopp/2772440 to your computer and use it in GitHub Desktop.
Save clayallsopp/2772440 to your computer and use it in GitHub Desktop.
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