summaryrefslogtreecommitdiff
path: root/spec/ruby/core/rational/to_i_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/rational/to_i_spec.rb')
-rw-r--r--spec/ruby/core/rational/to_i_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/ruby/core/rational/to_i_spec.rb b/spec/ruby/core/rational/to_i_spec.rb
index fda6b06e96..e61b1b6c3b 100644
--- a/spec/ruby/core/rational/to_i_spec.rb
+++ b/spec/ruby/core/rational/to_i_spec.rb
@@ -1,5 +1,12 @@
-require File.expand_path('../../../shared/rational/to_i', __FILE__)
+require_relative "../../spec_helper"
describe "Rational#to_i" do
- it_behaves_like(:rational_to_i, :to_i)
+ 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