mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 19:44:01 +02: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:
parent
75c4e9b72e
commit
7e1fddba4a
1 changed files with 6 additions and 0 deletions
|
@ -92,6 +92,12 @@ describe "Time.at" do
|
||||||
o.should_receive(:to_r).and_return(Rational(5, 2))
|
o.should_receive(:to_r).and_return(Rational(5, 2))
|
||||||
Time.at(o).should == Time.at(Rational(5, 2))
|
Time.at(o).should == Time.at(Rational(5, 2))
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue