Skip to content

Commit

Permalink
States Time.at expects rational-like argument to respond to #to_int
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Aug 28, 2020
1 parent 75c4e9b commit 7e1fddb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/ruby/core/time/at_spec.rb
Expand Up @@ -92,6 +92,12 @@
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

Expand Down

0 comments on commit 7e1fddb

Please sign in to comment.