Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created August 7, 2013 02:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyanny/6170734 to your computer and use it in GitHub Desktop.
Save kyanny/6170734 to your computer and use it in GitHub Desktop.
require 'active_support/core_ext'
require 'minitest/unit'
String.instance_eval do
define_method :method_missing do |method, *args|
ActiveSupport::StringInquirer.new(self).send(method)
end
end
Symbol.instance_eval do
define_method :method_missing do |method, *args|
ActiveSupport::StringInquirer.new(self.to_s).send(method)
end
end
class TestString < MiniTest::Unit::TestCase
def test_boolianize
assert "foo".foo?
end
end
class TestSymbol < MiniTest::Unit::TestCase
def test_boolianize
assert :foo.foo?
end
end
if __FILE__ == $0
MiniTest::Unit.autorun
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment