diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-08-28 19:35:54 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-08-28 19:47:29 +0900 |
commit | 7e1fddba4a609cb7bf4a696eccd892e68753bb21 (patch) | |
tree | 21e1544bfab3012f87536812bc8235f52bfd5273 /spec/ruby/core | |
parent | 75c4e9b72eca22b087c8c2d6d8a950922545aa00 (diff) | |
download | ruby-7e1fddba4a609cb7bf4a696eccd892e68753bb21.tar.gz |
States Time.at expects rational-like argument to respond to #to_int
https://bugs.ruby-lang.org/issues/17131
Diffstat (limited to 'spec/ruby/core')
-rw-r--r-- | spec/ruby/core/time/at_spec.rb | 6 |
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 |