diff options
Diffstat (limited to 'spec/rubyspec/shared/rational/to_f.rb')
-rw-r--r-- | spec/rubyspec/shared/rational/to_f.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/rubyspec/shared/rational/to_f.rb b/spec/rubyspec/shared/rational/to_f.rb new file mode 100644 index 0000000000..2c9afdddda --- /dev/null +++ b/spec/rubyspec/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 |