summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-08-28 19:35:54 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-08-28 19:47:29 +0900
commit7e1fddba4a609cb7bf4a696eccd892e68753bb21 (patch)
tree21e1544bfab3012f87536812bc8235f52bfd5273
parent75c4e9b72eca22b087c8c2d6d8a950922545aa00 (diff)
States Time.at expects rational-like argument to respond to #to_int
https://bugs.ruby-lang.org/issues/17131
-rw-r--r--spec/ruby/core/time/at_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/time/at_spec.rb b/spec/ruby/core/time/at_spec.rb
index 6f4d83f9ad..4ff38bbd21 100644
--- a/spec/ruby/core/time/at_spec.rb
+++ b/spec/ruby/core/time/at_spec.rb
@@ -92,6 +92,12 @@ describe "Time.at" do
o.should_receive(:to_r).and_return(Rational(5, 2))
Time.at(o).should == Time.at(Rational(5, 2))
end
+
+ it "needs for the argument to respond to #to_int too" do
+ o = mock('rational-but-no-to_int')
+ o.should_receive(:to_r).and_return(Rational(5, 2))
+ -> { Time.at(o) }.should raise_error(TypeError)
+ end
end
end