diff options
Diffstat (limited to 'spec/ruby/core/rational/to_i_spec.rb')
| -rw-r--r-- | spec/ruby/core/rational/to_i_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/core/rational/to_i_spec.rb b/spec/ruby/core/rational/to_i_spec.rb new file mode 100644 index 0000000000..e61b1b6c3b --- /dev/null +++ b/spec/ruby/core/rational/to_i_spec.rb @@ -0,0 +1,12 @@ +require_relative "../../spec_helper" + +describe "Rational#to_i" do + it "converts self to an Integer by truncation" do + Rational(7, 4).to_i.should.eql?(1) + Rational(11, 4).to_i.should.eql?(2) + end + + it "converts self to an Integer by truncation" do + Rational(-7, 4).to_i.should.eql?(-1) + end +end |
