diff options
Diffstat (limited to 'spec/ruby/core/numeric/imaginary_spec.rb')
| -rw-r--r-- | spec/ruby/core/numeric/imaginary_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/ruby/core/numeric/imaginary_spec.rb b/spec/ruby/core/numeric/imaginary_spec.rb index 41226569b3..7b5d94cc75 100644 --- a/spec/ruby/core/numeric/imaginary_spec.rb +++ b/spec/ruby/core/numeric/imaginary_spec.rb @@ -1,6 +1,26 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../../../shared/complex/numeric/imag', __FILE__) +require_relative '../../spec_helper' describe "Numeric#imaginary" do - it_behaves_like(:numeric_imag, :imaginary) + before :each do + @numbers = [ + 20, # Integer + 398.72, # Float + Rational(3, 4), # Rational + bignum_value, # Bignum + infinity_value, + nan_value + ].map{|n| [n,-n]}.flatten + end + + it "returns 0" do + @numbers.each do |number| + number.imaginary.should == 0 + end + end + + it "raises an ArgumentError if given any arguments" do + @numbers.each do |number| + -> { number.imaginary(number) }.should.raise(ArgumentError) + end + end end |
