From 7e1fddba4a609cb7bf4a696eccd892e68753bb21 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 28 Aug 2020 19:35:54 +0900 Subject: [PATCH] States Time.at expects rational-like argument to respond to #to_int https://bugs.ruby-lang.org/issues/17131 --- spec/ruby/core/time/at_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) 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