fOOrth/tests/monkey_patch/rational_test.rb

29 lines
No EOL
749 B
Ruby

# coding: utf-8
require_relative '../../lib/fOOrth/monkey_patch/numeric'
require_relative '../../lib/fOOrth/monkey_patch/rational'
require 'minitest/autorun'
#Test the monkey patches applied to the Object class.
class RationalMonkeyPatchTester < MiniTest::Unit::TestCase
#Special initialize to track rake progress.
def initialize(*all)
$do_this_only_one_time = "" unless defined? $do_this_only_one_time
if $do_this_only_one_time != __FILE__
puts
puts "Running test file: #{File.split(__FILE__)[1]}"
$do_this_only_one_time = __FILE__
end
super(*all)
end
#Test that it embeds
def test_embed
rat = '1/2'.to_r
assert_equal(rat.embed, "'1/2'.to_r")
end
end