aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/complex/inspect_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/complex/inspect_spec.rb')
-rw-r--r--spec/ruby/core/complex/inspect_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/ruby/core/complex/inspect_spec.rb b/spec/ruby/core/complex/inspect_spec.rb
index a1c9469d71..71aabde5be 100644
--- a/spec/ruby/core/complex/inspect_spec.rb
+++ b/spec/ruby/core/complex/inspect_spec.rb
@@ -1,5 +1,16 @@
-require_relative '../../shared/complex/inspect'
+require_relative '../../spec_helper'
describe "Complex#inspect" do
- it_behaves_like :complex_inspect, :inspect
+ it "returns (${real}+${image}i) for positive imaginary parts" do
+ Complex(1).inspect.should == "(1+0i)"
+ Complex(7).inspect.should == "(7+0i)"
+ Complex(-1, 4).inspect.should == "(-1+4i)"
+ Complex(-7, 6.7).inspect.should == "(-7+6.7i)"
+ end
+
+ it "returns (${real}-${image}i) for negative imaginary parts" do
+ Complex(0, -1).inspect.should == "(0-1i)"
+ Complex(-1, -4).inspect.should == "(-1-4i)"
+ Complex(-7, -6.7).inspect.should == "(-7-6.7i)"
+ end
end