Created
December 21, 2016 16:16
-
-
Save utilum/78918f1b64f8b61ee732cb266db7c43a to your computer and use it in GitHub Desktop.
Test that although Complex and Rational raise on #dup, we consider them #duplicable?
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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails", github: "rails/rails" | |
end | |
require "active_support" | |
require "active_support/core_ext/object/duplicable" | |
require "minitest/autorun" | |
class BugTest < Minitest::Test | |
def test_complex_duplicable | |
assert_raises(TypeError) { Complex(1).dup } | |
refute Complex(1).duplicable?, "expected instance of Complex not to be `duplicable?`" | |
end | |
def test_rational_duplicable | |
assert_raises(TypeError) { Rational(1).dup } | |
refute Rational(1).duplicable?, "expected instance of Rational not to be `duplicable?`" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment