Created
June 20, 2011 16:53
-
-
Save softr8/1035981 to your computer and use it in GitHub Desktop.
Mocking methods at instance level
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
class Una | |
def get | |
"Esta es una prueba" | |
end | |
end | |
dos = Class.new(Una) do | |
def get | |
"desde aca" | |
end | |
end.new | |
tres = Una.new | |
puts dos.get #prints "desde aca" | |
puts tres.get #prints "Esta es una prueba" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment