[前][次][番号順一覧][スレッド一覧]

ruby-changes:62741

From: Nobuyoshi <ko1@a...>
Date: Fri, 28 Aug 2020 19:47:50 +0900 (JST)
Subject: [ruby-changes:62741] 7e1fddba4a (master): States Time.at expects rational-like argument to respond to #to_int

https://git.ruby-lang.org/ruby.git/commit/?id=7e1fddba4a

From 7e1fddba4a609cb7bf4a696eccd892e68753bb21 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 28 Aug 2020 19:35:54 +0900
Subject: States Time.at expects rational-like argument to respond to #to_int

https://bugs.ruby-lang.org/issues/17131

diff --git a/spec/ruby/core/time/at_spec.rb b/spec/ruby/core/time/at_spec.rb
index 6f4d83f..4ff38bb 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/time/at_spec.rb#L92
         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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]