mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75bfc6440d
commit
1d15d5f080
4370 changed files with 0 additions and 0 deletions
11
spec/ruby/core/nil/and_spec.rb
Normal file
11
spec/ruby/core/nil/and_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#&" do
|
||||
it "returns false" do
|
||||
(nil & nil).should == false
|
||||
(nil & true).should == false
|
||||
(nil & false).should == false
|
||||
(nil & "").should == false
|
||||
(nil & mock('x')).should == false
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/inspect_spec.rb
Normal file
7
spec/ruby/core/nil/inspect_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#inspect" do
|
||||
it "returns the string 'nil'" do
|
||||
nil.inspect.should == "nil"
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/nil_spec.rb
Normal file
7
spec/ruby/core/nil/nil_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#nil?" do
|
||||
it "returns true" do
|
||||
nil.nil?.should == true
|
||||
end
|
||||
end
|
15
spec/ruby/core/nil/nilclass_spec.rb
Normal file
15
spec/ruby/core/nil/nilclass_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass" do
|
||||
it ".allocate raises a TypeError" do
|
||||
lambda do
|
||||
NilClass.allocate
|
||||
end.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it ".new is undefined" do
|
||||
lambda do
|
||||
NilClass.new
|
||||
end.should raise_error(NoMethodError)
|
||||
end
|
||||
end
|
11
spec/ruby/core/nil/or_spec.rb
Normal file
11
spec/ruby/core/nil/or_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#|" do
|
||||
it "returns false if other is nil or false, otherwise true" do
|
||||
(nil | nil).should == false
|
||||
(nil | true).should == true
|
||||
(nil | false).should == false
|
||||
(nil | "").should == true
|
||||
(nil | mock('x')).should == true
|
||||
end
|
||||
end
|
16
spec/ruby/core/nil/rationalize_spec.rb
Normal file
16
spec/ruby/core/nil/rationalize_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#rationalize" do
|
||||
it "returns 0/1" do
|
||||
nil.rationalize.should == Rational(0, 1)
|
||||
end
|
||||
|
||||
it "ignores a single argument" do
|
||||
nil.rationalize(0.1).should == Rational(0, 1)
|
||||
end
|
||||
|
||||
it "raises ArgumentError when passed more than one argument" do
|
||||
lambda { nil.rationalize(0.1, 0.1) }.should raise_error(ArgumentError)
|
||||
lambda { nil.rationalize(0.1, 0.1, 2) }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/to_a_spec.rb
Normal file
7
spec/ruby/core/nil/to_a_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_a" do
|
||||
it "returns an empty array" do
|
||||
nil.to_a.should == []
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/to_c_spec.rb
Normal file
7
spec/ruby/core/nil/to_c_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_c" do
|
||||
it "returns Complex(0, 0)" do
|
||||
nil.to_c.should eql(Complex(0, 0))
|
||||
end
|
||||
end
|
11
spec/ruby/core/nil/to_f_spec.rb
Normal file
11
spec/ruby/core/nil/to_f_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_f" do
|
||||
it "returns 0.0" do
|
||||
nil.to_f.should == 0.0
|
||||
end
|
||||
|
||||
it "does not cause NilClass to be coerced to Float" do
|
||||
(0.0 == nil).should == false
|
||||
end
|
||||
end
|
8
spec/ruby/core/nil/to_h_spec.rb
Normal file
8
spec/ruby/core/nil/to_h_spec.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_h" do
|
||||
it "returns an empty hash" do
|
||||
nil.to_h.should == {}
|
||||
nil.to_h.default.should == nil
|
||||
end
|
||||
end
|
11
spec/ruby/core/nil/to_i_spec.rb
Normal file
11
spec/ruby/core/nil/to_i_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_i" do
|
||||
it "returns 0" do
|
||||
nil.to_i.should == 0
|
||||
end
|
||||
|
||||
it "does not cause NilClass to be coerced to Fixnum" do
|
||||
(0 == nil).should == false
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/to_r_spec.rb
Normal file
7
spec/ruby/core/nil/to_r_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_r" do
|
||||
it "returns 0/1" do
|
||||
nil.to_r.should == Rational(0, 1)
|
||||
end
|
||||
end
|
7
spec/ruby/core/nil/to_s_spec.rb
Normal file
7
spec/ruby/core/nil/to_s_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#to_s" do
|
||||
it "returns the string ''" do
|
||||
nil.to_s.should == ""
|
||||
end
|
||||
end
|
11
spec/ruby/core/nil/xor_spec.rb
Normal file
11
spec/ruby/core/nil/xor_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require File.expand_path('../../../spec_helper', __FILE__)
|
||||
|
||||
describe "NilClass#^" do
|
||||
it "returns false if other is nil or false, otherwise true" do
|
||||
(nil ^ nil).should == false
|
||||
(nil ^ true).should == true
|
||||
(nil ^ false).should == false
|
||||
(nil ^ "").should == true
|
||||
(nil ^ mock('x')).should == true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue