Created
August 7, 2013 02:40
-
-
Save kyanny/6170734 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
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