summaryrefslogtreecommitdiff
path: root/spec/ruby/core/numeric/imaginary_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/numeric/imaginary_spec.rb')
-rw-r--r--spec/ruby/core/numeric/imaginary_spec.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/ruby/core/numeric/imaginary_spec.rb b/spec/ruby/core/numeric/imaginary_spec.rb
index ec708cb505..7b5d94cc75 100644
--- a/spec/ruby/core/numeric/imaginary_spec.rb
+++ b/spec/ruby/core/numeric/imaginary_spec.rb
@@ -1,6 +1,26 @@
require_relative '../../spec_helper'
-require_relative 'shared/imag'
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