summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/rational/to_f.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/rational/to_f.rb')
-rw-r--r--spec/ruby/shared/rational/to_f.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/shared/rational/to_f.rb b/spec/ruby/shared/rational/to_f.rb
new file mode 100644
index 0000000000..2c9afdddda
--- /dev/null
+++ b/spec/ruby/shared/rational/to_f.rb
@@ -0,0 +1,10 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe :rational_to_f, shared: true do
+ it "returns self converted to a Float" do
+ Rational(3, 4).to_f.should eql(0.75)
+ Rational(3, -4).to_f.should eql(-0.75)
+ Rational(-1, 4).to_f.should eql(-0.25)
+ Rational(-1, -4).to_f.should eql(0.25)
+ end
+end