Skip to content

Instantly share code, notes, and snippets.

@JoshBrodieNZ
Last active December 25, 2015 23:29
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 JoshBrodieNZ/7057197 to your computer and use it in GitHub Desktop.
Save JoshBrodieNZ/7057197 to your computer and use it in GitHub Desktop.
Reimplement a user-customisable version of the test class for codewars.com
class Class
def method_added(method_name)
puts "#{method_name} to #{self}"
if method_name == :after
newtest = Test.dup
Object.send(:remove_const, :Test)
Object.const_set(:Test, newtest)
Test.module_eval do
def self.expect(*args)
puts "LOOK, MA. I CAN CHANGE IT."
super
end
end
Test.freeze
end
end
end
@JoshBrodieNZ
Copy link
Author

Include in self-expect args[0] = true and super(args) to INJECT VICTORY INTO THE HEART OF TEST

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment