summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/rational/to_s.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/rational/to_s.rb')
-rw-r--r--spec/ruby/shared/rational/to_s.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/shared/rational/to_s.rb b/spec/ruby/shared/rational/to_s.rb
new file mode 100644
index 0000000000..429a021908
--- /dev/null
+++ b/spec/ruby/shared/rational/to_s.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe :rational_to_s, shared: true do
+ it "returns a string representation of self" do
+ Rational(1, 1).to_s.should == "1/1"
+ Rational(2, 1).to_s.should == "2/1"
+ Rational(1, 2).to_s.should == "1/2"
+ Rational(-1, 3).to_s.should == "-1/3"
+ Rational(1, -3).to_s.should == "-1/3"
+ end
+end