1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

States Time.at expects rational-like argument to respond to #to_int

https://bugs.ruby-lang.org/issues/17131
This commit is contained in:
Nobuyoshi Nakada 2020-08-28 19:35:54 +09:00
parent 75c4e9b72e
commit 7e1fddba4a
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -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