mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@032ee74
This commit is contained in:
parent
f646d20aae
commit
5aaa75e7c1
263 changed files with 921 additions and 921 deletions
|
@ -3,9 +3,9 @@ require_relative '../spec_helper'
|
|||
describe "The error message caused by an exception" do
|
||||
it "is not printed to stdout" do
|
||||
out = ruby_exe("this_does_not_exist", args: "2> #{File::NULL}")
|
||||
out.chomp.empty?.should == true
|
||||
out.chomp.should.empty?
|
||||
|
||||
out = ruby_exe("end #syntax error", args: "2> #{File::NULL}")
|
||||
out.chomp.empty?.should == true
|
||||
out.chomp.should.empty?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ describe "ARGF.binmode" do
|
|||
it "sets the file's encoding to BINARY" do
|
||||
argf [@bin_file, @file1] do
|
||||
@argf.binmode
|
||||
@argf.binmode?.should == true
|
||||
@argf.should.binmode?
|
||||
@argf.gets.encoding.should == Encoding::BINARY
|
||||
@argf.skip
|
||||
@argf.read.encoding.should == Encoding::BINARY
|
||||
|
|
|
@ -4,17 +4,17 @@ describe "Array#any?" do
|
|||
describe 'with no block given (a default block of { |x| x } is implicit)' do
|
||||
it "is false if the array is empty" do
|
||||
empty_array = []
|
||||
empty_array.any?.should == false
|
||||
empty_array.should_not.any?
|
||||
end
|
||||
|
||||
it "is false if the array is not empty, but all the members of the array are falsy" do
|
||||
falsy_array = [false, nil, false]
|
||||
falsy_array.any?.should == false
|
||||
falsy_array.should_not.any?
|
||||
end
|
||||
|
||||
it "is true if the array has any truthy members" do
|
||||
not_empty_array = ['anything', nil]
|
||||
not_empty_array.any?.should == true
|
||||
not_empty_array.should.any?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ describe "Array#clear" do
|
|||
it "leaves the Array empty" do
|
||||
a = [1]
|
||||
a.clear
|
||||
a.empty?.should == true
|
||||
a.should.empty?
|
||||
a.size.should == 0
|
||||
end
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ describe "Array#clone" do
|
|||
aa = a.clone
|
||||
bb = b.clone
|
||||
|
||||
aa.frozen?.should == true
|
||||
bb.frozen?.should == false
|
||||
aa.should.frozen?
|
||||
bb.should_not.frozen?
|
||||
end
|
||||
|
||||
it "copies singleton methods" do
|
||||
|
|
|
@ -3,8 +3,8 @@ require_relative 'fixtures/classes'
|
|||
|
||||
describe "Array#empty?" do
|
||||
it "returns true if the array has no elements" do
|
||||
[].empty?.should == true
|
||||
[1].empty?.should == false
|
||||
[1, 2].empty?.should == false
|
||||
[].should.empty?
|
||||
[1].should_not.empty?
|
||||
[1, 2].should_not.empty?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,13 +4,13 @@ require_relative 'fixtures/classes'
|
|||
describe "Array#frozen?" do
|
||||
it "returns true if array is frozen" do
|
||||
a = [1, 2, 3]
|
||||
a.frozen?.should == false
|
||||
a.should_not.frozen?
|
||||
a.freeze
|
||||
a.frozen?.should == true
|
||||
a.should.frozen?
|
||||
end
|
||||
|
||||
it "returns false for an array being sorted by #sort" do
|
||||
a = [1, 2, 3]
|
||||
a.sort { |x,y| a.frozen?.should == false; x <=> y }
|
||||
a.sort { |x,y| a.should_not.frozen?; x <=> y }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -92,39 +92,39 @@ describe "Array#* with an integer" do
|
|||
it "copies the taint status of the original array even if the passed count is 0" do
|
||||
ary = [1, 2, 3]
|
||||
ary.taint
|
||||
(ary * 0).tainted?.should == true
|
||||
(ary * 0).should.tainted?
|
||||
end
|
||||
|
||||
it "copies the taint status of the original array even if the array is empty" do
|
||||
ary = []
|
||||
ary.taint
|
||||
(ary * 3).tainted?.should == true
|
||||
(ary * 3).should.tainted?
|
||||
end
|
||||
|
||||
it "copies the taint status of the original array if the passed count is not 0" do
|
||||
ary = [1, 2, 3]
|
||||
ary.taint
|
||||
(ary * 1).tainted?.should == true
|
||||
(ary * 2).tainted?.should == true
|
||||
(ary * 1).should.tainted?
|
||||
(ary * 2).should.tainted?
|
||||
end
|
||||
|
||||
it "copies the untrusted status of the original array even if the passed count is 0" do
|
||||
ary = [1, 2, 3]
|
||||
ary.untrust
|
||||
(ary * 0).untrusted?.should == true
|
||||
(ary * 0).should.untrusted?
|
||||
end
|
||||
|
||||
it "copies the untrusted status of the original array even if the array is empty" do
|
||||
ary = []
|
||||
ary.untrust
|
||||
(ary * 3).untrusted?.should == true
|
||||
(ary * 3).should.untrusted?
|
||||
end
|
||||
|
||||
it "copies the untrusted status of the original array if the passed count is not 0" do
|
||||
ary = [1, 2, 3]
|
||||
ary.untrust
|
||||
(ary * 1).untrusted?.should == true
|
||||
(ary * 2).untrusted?.should == true
|
||||
(ary * 1).should.untrusted?
|
||||
(ary * 2).should.untrusted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,8 +26,8 @@ describe :array_clone, shared: true do
|
|||
aa = a.send @method
|
||||
bb = b.send @method
|
||||
|
||||
aa.tainted?.should == true
|
||||
bb.tainted?.should == false
|
||||
aa.should.tainted?
|
||||
bb.should_not.tainted?
|
||||
end
|
||||
|
||||
it "copies untrusted status from the original" do
|
||||
|
@ -37,8 +37,8 @@ describe :array_clone, shared: true do
|
|||
aa = a.send @method
|
||||
bb = b.send @method
|
||||
|
||||
aa.untrusted?.should == true
|
||||
bb.untrusted?.should == false
|
||||
aa.should.untrusted?
|
||||
bb.should_not.untrusted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,9 +58,9 @@ describe "Array#sort" do
|
|||
b = ArraySpecs::MockForCompared.new
|
||||
c = ArraySpecs::MockForCompared.new
|
||||
|
||||
ArraySpecs::MockForCompared.compared?.should == false
|
||||
ArraySpecs::MockForCompared.should_not.compared?
|
||||
[a, b, c].sort.should == [c, b, a]
|
||||
ArraySpecs::MockForCompared.compared?.should == true
|
||||
ArraySpecs::MockForCompared.should.compared?
|
||||
end
|
||||
|
||||
it "does not deal with exceptions raised by unimplemented or incorrect #<=>" do
|
||||
|
@ -104,7 +104,7 @@ describe "Array#sort" do
|
|||
|
||||
it "does not freezes self during being sorted" do
|
||||
a = [1, 2, 3]
|
||||
a.sort { |x,y| a.frozen?.should == false; x <=> y }
|
||||
a.sort { |x,y| a.should_not.frozen?; x <=> y }
|
||||
end
|
||||
|
||||
it "returns the specified value when it would break in the given block" do
|
||||
|
@ -207,9 +207,9 @@ describe "Array#sort!" do
|
|||
b = ArraySpecs::MockForCompared.new
|
||||
c = ArraySpecs::MockForCompared.new
|
||||
|
||||
ArraySpecs::MockForCompared.compared?.should == false
|
||||
ArraySpecs::MockForCompared.should_not.compared?
|
||||
[a, b, c].sort!.should == [c, b, a]
|
||||
ArraySpecs::MockForCompared.compared?.should == true
|
||||
ArraySpecs::MockForCompared.should.compared?
|
||||
end
|
||||
|
||||
it "does not call #<=> on contained objects when invoked with a block" do
|
||||
|
|
|
@ -87,8 +87,8 @@ describe "Array#uniq" do
|
|||
end
|
||||
|
||||
a.uniq.should == a
|
||||
a[0].tainted?.should == true
|
||||
a[1].tainted?.should == true
|
||||
a[0].should.tainted?
|
||||
a[1].should.tainted?
|
||||
|
||||
a = Array.new(2) do
|
||||
obj = mock('0')
|
||||
|
@ -106,8 +106,8 @@ describe "Array#uniq" do
|
|||
end
|
||||
|
||||
a.uniq.size.should == 1
|
||||
a[0].tainted?.should == true
|
||||
a[1].tainted?.should == true
|
||||
a[0].should.tainted?
|
||||
a[1].should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ describe "Class#allocate" do
|
|||
end
|
||||
end
|
||||
|
||||
klass.allocate.initialized?.should == false
|
||||
klass.allocate.should_not.initialized?
|
||||
end
|
||||
|
||||
it "raises TypeError for #superclass" do
|
||||
|
|
|
@ -126,7 +126,7 @@ describe "Class#new" do
|
|||
end
|
||||
end
|
||||
|
||||
klass.new.initialized?.should == true
|
||||
klass.new.should.initialized?
|
||||
klass.new(1, 2, 3).args.should == [1, 2, 3]
|
||||
end
|
||||
|
||||
|
|
|
@ -2,31 +2,31 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Complex#finite?" do
|
||||
it "returns true if magnitude is finite" do
|
||||
(1+1i).finite?.should == true
|
||||
(1+1i).should.finite?
|
||||
end
|
||||
|
||||
it "returns false for positive infinity" do
|
||||
value = Complex(Float::INFINITY, 42)
|
||||
value.finite?.should == false
|
||||
value.should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for positive complex with infinite imaginary" do
|
||||
value = Complex(1, Float::INFINITY)
|
||||
value.finite?.should == false
|
||||
value.should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for negative infinity" do
|
||||
value = -Complex(Float::INFINITY, 42)
|
||||
value.finite?.should == false
|
||||
value.should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for negative complex with infinite imaginary" do
|
||||
value = -Complex(1, Float::INFINITY)
|
||||
value.finite?.should == false
|
||||
value.should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for NaN" do
|
||||
value = Complex(Float::NAN, Float::NAN)
|
||||
value.finite?.should == false
|
||||
value.should_not.finite?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -119,7 +119,7 @@ describe "Dir.glob" do
|
|||
end
|
||||
|
||||
it "handles infinite directory wildcards" do
|
||||
Dir.glob('**/**/**').empty?.should == false
|
||||
Dir.glob('**/**/**').should_not.empty?
|
||||
end
|
||||
|
||||
it "handles simple filename patterns" do
|
||||
|
|
|
@ -17,7 +17,7 @@ describe "Dir.home" do
|
|||
end
|
||||
|
||||
it "returns a non-frozen string" do
|
||||
Dir.home.frozen?.should == false
|
||||
Dir.home.should_not.frozen?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe "Dir.home" do
|
|||
end
|
||||
|
||||
it "returns a non-frozen string" do
|
||||
Dir.home(ENV['USER']).frozen?.should == false
|
||||
Dir.home(ENV['USER']).should_not.frozen?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ describe :dir_open, shared: true do
|
|||
Dir.send(@method, DirSpecs.mock_dir) do |dir|
|
||||
io = IO.for_fd(dir.fileno)
|
||||
io.autoclose = false
|
||||
io.close_on_exec?.should == true
|
||||
io.should.close_on_exec?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,13 +10,13 @@ describe "Enumerable#all?" do
|
|||
end
|
||||
|
||||
it "always returns true on empty enumeration" do
|
||||
@empty.all?.should == true
|
||||
@empty.should.all?
|
||||
@empty.all? { nil }.should == true
|
||||
|
||||
[].all?.should == true
|
||||
[].should.all?
|
||||
[].all? { false }.should == true
|
||||
|
||||
{}.all?.should == true
|
||||
{}.should.all?
|
||||
{}.all? { nil }.should == true
|
||||
end
|
||||
|
||||
|
@ -38,24 +38,24 @@ describe "Enumerable#all?" do
|
|||
|
||||
describe "with no block" do
|
||||
it "returns true if no elements are false or nil" do
|
||||
@enum.all?.should == true
|
||||
@enum1.all?.should == true
|
||||
@enum2.all?.should == false
|
||||
@enum.should.all?
|
||||
@enum1.should.all?
|
||||
@enum2.should_not.all?
|
||||
|
||||
EnumerableSpecs::Numerous.new('a','b','c').all?.should == true
|
||||
EnumerableSpecs::Numerous.new(0, "x", true).all?.should == true
|
||||
EnumerableSpecs::Numerous.new('a','b','c').should.all?
|
||||
EnumerableSpecs::Numerous.new(0, "x", true).should.all?
|
||||
end
|
||||
|
||||
it "returns false if there are false or nil elements" do
|
||||
EnumerableSpecs::Numerous.new(false).all?.should == false
|
||||
EnumerableSpecs::Numerous.new(false, false).all?.should == false
|
||||
EnumerableSpecs::Numerous.new(false).should_not.all?
|
||||
EnumerableSpecs::Numerous.new(false, false).should_not.all?
|
||||
|
||||
EnumerableSpecs::Numerous.new(nil).all?.should == false
|
||||
EnumerableSpecs::Numerous.new(nil, nil).all?.should == false
|
||||
EnumerableSpecs::Numerous.new(nil).should_not.all?
|
||||
EnumerableSpecs::Numerous.new(nil, nil).should_not.all?
|
||||
|
||||
EnumerableSpecs::Numerous.new(1, nil, 2).all?.should == false
|
||||
EnumerableSpecs::Numerous.new(0, "x", false, true).all?.should == false
|
||||
@enum2.all?.should == false
|
||||
EnumerableSpecs::Numerous.new(1, nil, 2).should_not.all?
|
||||
EnumerableSpecs::Numerous.new(0, "x", false, true).should_not.all?
|
||||
@enum2.should_not.all?
|
||||
end
|
||||
|
||||
it "gathers whole arrays as elements when each yields multiple" do
|
||||
|
|
|
@ -10,13 +10,13 @@ describe "Enumerable#any?" do
|
|||
end
|
||||
|
||||
it "always returns false on empty enumeration" do
|
||||
@empty.any?.should == false
|
||||
@empty.should_not.any?
|
||||
@empty.any? { nil }.should == false
|
||||
|
||||
[].any?.should == false
|
||||
[].should_not.any?
|
||||
[].any? { false }.should == false
|
||||
|
||||
{}.any?.should == false
|
||||
{}.should_not.any?
|
||||
{}.any? { nil }.should == false
|
||||
end
|
||||
|
||||
|
@ -38,24 +38,24 @@ describe "Enumerable#any?" do
|
|||
|
||||
describe "with no block" do
|
||||
it "returns true if any element is not false or nil" do
|
||||
@enum.any?.should == true
|
||||
@enum1.any?.should == true
|
||||
@enum2.any?.should == true
|
||||
EnumerableSpecs::Numerous.new(true).any?.should == true
|
||||
EnumerableSpecs::Numerous.new('a','b','c').any?.should == true
|
||||
EnumerableSpecs::Numerous.new('a','b','c', nil).any?.should == true
|
||||
EnumerableSpecs::Numerous.new(1, nil, 2).any?.should == true
|
||||
EnumerableSpecs::Numerous.new(1, false).any?.should == true
|
||||
EnumerableSpecs::Numerous.new(false, nil, 1, false).any?.should == true
|
||||
EnumerableSpecs::Numerous.new(false, 0, nil).any?.should == true
|
||||
@enum.should.any?
|
||||
@enum1.should.any?
|
||||
@enum2.should.any?
|
||||
EnumerableSpecs::Numerous.new(true).should.any?
|
||||
EnumerableSpecs::Numerous.new('a','b','c').should.any?
|
||||
EnumerableSpecs::Numerous.new('a','b','c', nil).should.any?
|
||||
EnumerableSpecs::Numerous.new(1, nil, 2).should.any?
|
||||
EnumerableSpecs::Numerous.new(1, false).should.any?
|
||||
EnumerableSpecs::Numerous.new(false, nil, 1, false).should.any?
|
||||
EnumerableSpecs::Numerous.new(false, 0, nil).should.any?
|
||||
end
|
||||
|
||||
it "returns false if all elements are false or nil" do
|
||||
EnumerableSpecs::Numerous.new(false).any?.should == false
|
||||
EnumerableSpecs::Numerous.new(false, false).any?.should == false
|
||||
EnumerableSpecs::Numerous.new(nil).any?.should == false
|
||||
EnumerableSpecs::Numerous.new(nil, nil).any?.should == false
|
||||
EnumerableSpecs::Numerous.new(nil, false, nil).any?.should == false
|
||||
EnumerableSpecs::Numerous.new(false).should_not.any?
|
||||
EnumerableSpecs::Numerous.new(false, false).should_not.any?
|
||||
EnumerableSpecs::Numerous.new(nil).should_not.any?
|
||||
EnumerableSpecs::Numerous.new(nil, nil).should_not.any?
|
||||
EnumerableSpecs::Numerous.new(nil, false, nil).should_not.any?
|
||||
end
|
||||
|
||||
it "gathers whole arrays as elements when each yields multiple" do
|
||||
|
|
|
@ -10,7 +10,7 @@ describe "Enumerable#none?" do
|
|||
end
|
||||
|
||||
it "always returns true on empty enumeration" do
|
||||
@empty.none?.should == true
|
||||
@empty.should.none?
|
||||
@empty.none? { true }.should == true
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ describe "Enumerable#one?" do
|
|||
end
|
||||
|
||||
it "always returns false on empty enumeration" do
|
||||
@empty.one?.should == false
|
||||
@empty.should_not.one?
|
||||
@empty.one? { true }.should == false
|
||||
end
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ describe 'Enumerable#uniq' do
|
|||
end
|
||||
|
||||
a.uniq.should == a
|
||||
a[0].tainted?.should == true
|
||||
a[1].tainted?.should == true
|
||||
a[0].should.tainted?
|
||||
a[1].should.tainted?
|
||||
|
||||
a = Array.new(2) do
|
||||
obj = mock('0')
|
||||
|
@ -98,8 +98,8 @@ describe 'Enumerable#uniq' do
|
|||
end
|
||||
|
||||
a.to_enum.uniq.size.should == 1
|
||||
a[0].tainted?.should == true
|
||||
a[1].tainted?.should == true
|
||||
a[0].should.tainted?
|
||||
a[1].should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ ruby_version_is "2.6" do
|
|||
describe "Enumerator::ArithmeticSequence#exclude_end?" do
|
||||
context "when created using Numeric#step" do
|
||||
it "always returns false" do
|
||||
1.step(10).exclude_end?.should == false
|
||||
10.step(1).exclude_end?.should == false
|
||||
1.step(10).should_not.exclude_end?
|
||||
10.step(1).should_not.exclude_end?
|
||||
end
|
||||
end
|
||||
|
||||
context "when created using Range#step" do
|
||||
it "mirrors range.exclude_end?" do
|
||||
(1...10).step.exclude_end?.should == true
|
||||
(1..10).step.exclude_end?.should == false
|
||||
(1...10).step.should.exclude_end?
|
||||
(1..10).step.should_not.exclude_end?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
2
spec/ruby/core/env/element_reference_spec.rb
vendored
2
spec/ruby/core/env/element_reference_spec.rb
vendored
|
@ -16,7 +16,7 @@ describe "ENV.[]" do
|
|||
|
||||
it "returns only frozen values" do
|
||||
ENV[@variable] = "a non-frozen string"
|
||||
ENV[@variable].frozen?.should == true
|
||||
ENV[@variable].should.frozen?
|
||||
end
|
||||
|
||||
it "coerces a non-string name with #to_str" do
|
||||
|
|
6
spec/ruby/core/env/empty_spec.rb
vendored
6
spec/ruby/core/env/empty_spec.rb
vendored
|
@ -4,12 +4,12 @@ describe "ENV.empty?" do
|
|||
|
||||
it "returns true if the Environment is empty" do
|
||||
if ENV.keys.size > 0
|
||||
ENV.empty?.should == false
|
||||
ENV.should_not.empty?
|
||||
end
|
||||
orig = ENV.to_hash
|
||||
begin
|
||||
ENV.clear
|
||||
ENV.empty?.should == true
|
||||
ENV.should.empty?
|
||||
ensure
|
||||
ENV.replace orig
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ describe "ENV.empty?" do
|
|||
|
||||
it "returns false if not empty" do
|
||||
if ENV.keys.size > 0
|
||||
ENV.empty?.should == false
|
||||
ENV.should_not.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
2
spec/ruby/core/env/shift_spec.rb
vendored
2
spec/ruby/core/env/shift_spec.rb
vendored
|
@ -2,7 +2,7 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "ENV.shift" do
|
||||
it "returns a pair and deletes it" do
|
||||
ENV.empty?.should == false
|
||||
ENV.should_not.empty?
|
||||
orig = ENV.to_hash
|
||||
begin
|
||||
pair = ENV.shift
|
||||
|
|
|
@ -3,13 +3,13 @@ require_relative '../../spec_helper'
|
|||
describe "SystemExit#success?" do
|
||||
it "returns true if the process exited successfully" do
|
||||
-> { exit 0 }.should raise_error(SystemExit) { |e|
|
||||
e.success?.should == true
|
||||
e.should.success?
|
||||
}
|
||||
end
|
||||
|
||||
it "returns false if the process exited unsuccessfully" do
|
||||
-> { exit(-1) }.should raise_error(SystemExit) { |e|
|
||||
e.success?.should == false
|
||||
e.should_not.success?
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe "FalseClass#to_s" do
|
|||
|
||||
ruby_version_is "2.7" do
|
||||
it "returns a frozen string" do
|
||||
false.to_s.frozen?.should == true
|
||||
false.to_s.should.frozen?
|
||||
end
|
||||
|
||||
it "always returns the same string" do
|
||||
|
|
|
@ -203,9 +203,9 @@ platform_is_not :windows do
|
|||
|
||||
it "does not return a frozen string" do
|
||||
home = "/rubyspec_home"
|
||||
File.expand_path('~').frozen?.should == false
|
||||
File.expand_path('~', '/tmp/gumby/ddd').frozen?.should == false
|
||||
File.expand_path('~/a', '/tmp/gumby/ddd').frozen?.should == false
|
||||
File.expand_path('~').should_not.frozen?
|
||||
File.expand_path('~', '/tmp/gumby/ddd').should_not.frozen?
|
||||
File.expand_path('~/a', '/tmp/gumby/ddd').should_not.frozen?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ describe "File.lchmod" do
|
|||
File.chmod(0222, @lname).should == 1
|
||||
File.lchmod(0755, @lname).should == 1
|
||||
|
||||
File.lstat(@lname).executable?.should == true
|
||||
File.lstat(@lname).readable?.should == true
|
||||
File.lstat(@lname).writable?.should == true
|
||||
File.lstat(@lname).should.executable?
|
||||
File.lstat(@lname).should.readable?
|
||||
File.lstat(@lname).should.writable?
|
||||
|
||||
File.stat(@lname).executable?.should == false
|
||||
File.stat(@lname).readable?.should == false
|
||||
File.stat(@lname).writable?.should == true
|
||||
File.stat(@lname).should_not.executable?
|
||||
File.stat(@lname).should_not.readable?
|
||||
File.stat(@lname).should.writable?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ describe "File.lstat" do
|
|||
it "returns a File::Stat object with symlink properties for a symlink" do
|
||||
st = File.lstat(@link)
|
||||
|
||||
st.symlink?.should == true
|
||||
st.file?.should == false
|
||||
st.should.symlink?
|
||||
st.should_not.file?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ describe "File.open" do
|
|||
describe "with a block" do
|
||||
it "does not raise error when file is closed inside the block" do
|
||||
@fh = File.open(@file) { |fh| fh.close; fh }
|
||||
@fh.closed?.should == true
|
||||
@fh.should.closed?
|
||||
end
|
||||
|
||||
it "invokes close on an opened file when exiting the block" do
|
||||
|
@ -485,7 +485,7 @@ describe "File.open" do
|
|||
File.size(@file).should > 0
|
||||
File.open(@file, "w+") do |f|
|
||||
f.pos.should == 0
|
||||
f.eof?.should == true
|
||||
f.should.eof?
|
||||
end
|
||||
File.size(@file).should == 0
|
||||
end
|
||||
|
@ -495,7 +495,7 @@ describe "File.open" do
|
|||
File.size(@file).should > 0
|
||||
File.open(@file, "rb+") do |f|
|
||||
f.pos.should == 0
|
||||
f.eof?.should == false
|
||||
f.should_not.eof?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -504,7 +504,7 @@ describe "File.open" do
|
|||
File.size(@file).should > 0
|
||||
File.open(@file, "wb+") do |f|
|
||||
f.pos.should == 0
|
||||
f.eof?.should == true
|
||||
f.should.eof?
|
||||
end
|
||||
File.size(@file).should == 0
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ describe "File::Stat#owned?" do
|
|||
|
||||
it "returns true if the file is owned by the user" do
|
||||
st = File.stat(@file)
|
||||
st.owned?.should == true
|
||||
st.should.owned?
|
||||
end
|
||||
|
||||
platform_is_not :windows, :android do
|
||||
|
@ -26,7 +26,7 @@ describe "File::Stat#owned?" do
|
|||
it "returns false if the file is not owned by the user" do
|
||||
system_file = '/etc/passwd'
|
||||
st = File.stat(system_file)
|
||||
st.owned?.should == false
|
||||
st.should_not.owned?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ describe "File::Stat#pipe?" do
|
|||
touch(filename)
|
||||
|
||||
st = File.stat(filename)
|
||||
st.pipe?.should == false
|
||||
st.should_not.pipe?
|
||||
|
||||
rm_r filename
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ describe "File::Stat#pipe?" do
|
|||
File.mkfifo(filename)
|
||||
|
||||
st = File.stat(filename)
|
||||
st.pipe?.should == true
|
||||
st.should.pipe?
|
||||
|
||||
rm_r filename
|
||||
end
|
||||
|
|
|
@ -23,8 +23,8 @@ platform_is_not :windows do
|
|||
|
||||
st = f.stat
|
||||
|
||||
st.file?.should == true
|
||||
st.zero?.should == false
|
||||
st.should.file?
|
||||
st.should_not.zero?
|
||||
st.size.should == 8
|
||||
st.size?.should == 8
|
||||
st.blksize.should >= 0
|
||||
|
@ -38,8 +38,8 @@ platform_is_not :windows do
|
|||
File.symlink(@file, @link)
|
||||
st = File.stat(@link)
|
||||
|
||||
st.file?.should == true
|
||||
st.symlink?.should == false
|
||||
st.should.file?
|
||||
st.should_not.symlink?
|
||||
end
|
||||
|
||||
it "returns an error when given missing non-ASCII path" do
|
||||
|
|
|
@ -18,7 +18,7 @@ describe "File.truncate" do
|
|||
|
||||
File.open(@name, "r") do |f|
|
||||
f.read(99).should == "12345"
|
||||
f.eof?.should == true
|
||||
f.should.eof?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ describe "File#truncate" do
|
|||
File.size(@name).should == 5
|
||||
File.open(@name, "r") do |f|
|
||||
f.read(99).should == "12345"
|
||||
f.eof?.should == true
|
||||
f.should.eof?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -161,7 +161,7 @@ describe "File#truncate" do
|
|||
|
||||
it "raises an IOError if file is closed" do
|
||||
@file.close
|
||||
@file.closed?.should == true
|
||||
@file.should.closed?
|
||||
-> { @file.truncate(42) }.should raise_error(IOError)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Float#finite?" do
|
||||
it "returns true for finite values" do
|
||||
3.14159.finite?.should == true
|
||||
3.14159.should.finite?
|
||||
end
|
||||
|
||||
it "returns false for positive infinity" do
|
||||
infinity_value.finite?.should == false
|
||||
infinity_value.should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for negative infinity" do
|
||||
(-infinity_value).finite?.should == false
|
||||
(-infinity_value).should_not.finite?
|
||||
end
|
||||
|
||||
it "returns false for NaN" do
|
||||
nan_value.finite?.should == false
|
||||
nan_value.should_not.finite?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Float#nan?" do
|
||||
it "returns true if self is not a valid IEEE floating-point number" do
|
||||
0.0.nan?.should == false
|
||||
-1.5.nan?.should == false
|
||||
nan_value.nan?.should == true
|
||||
0.0.should_not.nan?
|
||||
-1.5.should_not.nan?
|
||||
nan_value.should.nan?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,6 @@ describe "Float#next_float" do
|
|||
end
|
||||
|
||||
it "returns NAN if NAN was the receiver" do
|
||||
Float::NAN.next_float.nan?.should == true
|
||||
Float::NAN.next_float.should.nan?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,6 +44,6 @@ describe "Float#prev_float" do
|
|||
end
|
||||
|
||||
it "returns NAN if NAN was the receiver" do
|
||||
Float::NAN.prev_float.nan?.should == true
|
||||
Float::NAN.prev_float.should.nan?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,6 @@ describe "Float#-@" do
|
|||
end
|
||||
|
||||
it "returns NaN for NaN" do
|
||||
nan_value.send(:-@).nan?.should == true
|
||||
nan_value.send(:-@).should.nan?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Float#zero?" do
|
||||
it "returns true if self is 0.0" do
|
||||
0.0.zero?.should == true
|
||||
1.0.zero?.should == false
|
||||
-1.0.zero?.should == false
|
||||
0.0.should.zero?
|
||||
1.0.should_not.zero?
|
||||
-1.0.should_not.zero?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,6 @@ describe "GC::Profiler.disable" do
|
|||
|
||||
it "disables the profiler" do
|
||||
GC::Profiler.disable
|
||||
GC::Profiler.enabled?.should == false
|
||||
GC::Profiler.should_not.enabled?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@ describe "GC::Profiler.enable" do
|
|||
|
||||
it "enables the profiler" do
|
||||
GC::Profiler.enable
|
||||
GC::Profiler.enabled?.should == true
|
||||
GC::Profiler.should.enabled?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,10 @@ describe "Hash#any?" do
|
|||
describe 'with no block given' do
|
||||
it "checks if there are any members of a Hash" do
|
||||
empty_hash = {}
|
||||
empty_hash.any?.should == false
|
||||
empty_hash.should_not.any?
|
||||
|
||||
hash_with_members = { 'key' => 'value' }
|
||||
hash_with_members.any?.should == true
|
||||
hash_with_members.should.any?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe "Hash#compare_by_identity" do
|
|||
it "has no effect on an already compare_by_identity hash" do
|
||||
@idh[:foo] = :bar
|
||||
@idh.compare_by_identity.should equal @idh
|
||||
@idh.compare_by_identity?.should == true
|
||||
@idh.should.compare_by_identity?
|
||||
@idh[:foo].should == :bar
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ require_relative 'fixtures/classes'
|
|||
|
||||
describe "Hash#empty?" do
|
||||
it "returns true if the hash has no entries" do
|
||||
{}.empty?.should == true
|
||||
{ 1 => 1 }.empty?.should == false
|
||||
{}.should.empty?
|
||||
{ 1 => 1 }.should_not.empty?
|
||||
end
|
||||
|
||||
it "returns true if the hash has no entries and has a default value" do
|
||||
Hash.new(5).empty?.should == true
|
||||
Hash.new { 5 }.empty?.should == true
|
||||
Hash.new { |hsh, k| hsh[k] = k }.empty?.should == true
|
||||
Hash.new(5).should.empty?
|
||||
Hash.new { 5 }.should.empty?
|
||||
Hash.new { |hsh, k| hsh[k] = k }.should.empty?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ describe "Hash#reject" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "does not taint the resulting hash" do
|
||||
h = { a: 1 }.taint
|
||||
h.reject {false}.tainted?.should == false
|
||||
h.reject {false}.should_not.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,7 +50,7 @@ describe :hash_store, shared: true do
|
|||
key << "bar"
|
||||
|
||||
h.should == { "foo" => 0 }
|
||||
h.keys[0].frozen?.should == true
|
||||
h.keys[0].should.frozen?
|
||||
end
|
||||
|
||||
it "doesn't duplicate and freeze already frozen string keys" do
|
||||
|
|
|
@ -21,13 +21,13 @@ describe "Hash#to_proc" do
|
|||
|
||||
ruby_version_is ""..."2.8" do
|
||||
it "is not a lambda" do
|
||||
@proc.lambda?.should == false
|
||||
@proc.should_not.lambda?
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.8" do
|
||||
it "is a lambda" do
|
||||
@proc.lambda?.should == true
|
||||
@proc.should.lambda?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ end
|
|||
|
||||
describe "Integer#integer?" do
|
||||
it "returns true for Integers" do
|
||||
0.integer?.should == true
|
||||
-1.integer?.should == true
|
||||
bignum_value.integer?.should == true
|
||||
0.should.integer?
|
||||
-1.should.integer?
|
||||
bignum_value.should.integer?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,24 +14,24 @@ describe "IO#close_on_exec=" do
|
|||
guard -> { platform_is_not :windows } do
|
||||
it "sets the close-on-exec flag if true" do
|
||||
@io.close_on_exec = true
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "sets the close-on-exec flag if non-false" do
|
||||
@io.close_on_exec = :true
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "unsets the close-on-exec flag if false" do
|
||||
@io.close_on_exec = true
|
||||
@io.close_on_exec = false
|
||||
@io.close_on_exec?.should == false
|
||||
@io.should_not.close_on_exec?
|
||||
end
|
||||
|
||||
it "unsets the close-on-exec flag if nil" do
|
||||
@io.close_on_exec = true
|
||||
@io.close_on_exec = nil
|
||||
@io.close_on_exec?.should == false
|
||||
@io.should_not.close_on_exec?
|
||||
end
|
||||
|
||||
it "ensures the IO's file descriptor is closed in exec'ed processes" do
|
||||
|
@ -64,12 +64,12 @@ describe "IO#close_on_exec?" do
|
|||
|
||||
guard -> { platform_is_not :windows } do
|
||||
it "returns true by default" do
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "returns true if set" do
|
||||
@io.close_on_exec = true
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "raises IOError if called on a closed IO" do
|
||||
|
|
|
@ -49,7 +49,7 @@ describe "IO#close_read" do
|
|||
|
||||
io.close_read
|
||||
|
||||
io.closed?.should == true
|
||||
io.should.closed?
|
||||
end
|
||||
|
||||
it "does nothing on closed stream" do
|
||||
|
|
|
@ -14,7 +14,7 @@ describe "IO#close" do
|
|||
|
||||
it "closes the stream" do
|
||||
@io.close
|
||||
@io.closed?.should == true
|
||||
@io.should.closed?
|
||||
end
|
||||
|
||||
it "returns nil" do
|
||||
|
|
|
@ -45,7 +45,7 @@ describe "IO#close_write" do
|
|||
|
||||
io.close_write
|
||||
|
||||
io.closed?.should == true
|
||||
io.should.closed?
|
||||
end
|
||||
|
||||
it "flushes and closes the write stream" do
|
||||
|
|
|
@ -51,16 +51,16 @@ end
|
|||
@i.close
|
||||
-> { @f.gets }.should_not raise_error(Exception)
|
||||
|
||||
@i.closed?.should == true
|
||||
@f.closed?.should == false
|
||||
@i.should.closed?
|
||||
@f.should_not.closed?
|
||||
end
|
||||
|
||||
it "allows closing the original IO without affecting the new one" do
|
||||
@f.close
|
||||
-> { @i.gets }.should_not raise_error(Exception)
|
||||
|
||||
@i.closed?.should == false
|
||||
@f.closed?.should == true
|
||||
@i.should_not.closed?
|
||||
@f.should.closed?
|
||||
end
|
||||
|
||||
it "raises IOError on closed stream" do
|
||||
|
@ -71,7 +71,7 @@ end
|
|||
@f.close_on_exec = true
|
||||
dup = @f.dup
|
||||
begin
|
||||
dup.close_on_exec?.should == true
|
||||
dup.should.close_on_exec?
|
||||
ensure
|
||||
dup.close
|
||||
end
|
||||
|
@ -79,7 +79,7 @@ end
|
|||
@f.close_on_exec = false
|
||||
dup = @f.dup
|
||||
begin
|
||||
dup.close_on_exec?.should == true
|
||||
dup.should.close_on_exec?
|
||||
ensure
|
||||
dup.close
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ describe "IO#eof?" do
|
|||
end
|
||||
|
||||
it "returns true on an empty stream that has just been opened" do
|
||||
File.open(@name) { |empty| empty.eof?.should == true }
|
||||
File.open(@name) { |empty| empty.should.eof? }
|
||||
end
|
||||
|
||||
it "raises IOError on stream not opened for reading" do
|
||||
|
@ -34,35 +34,35 @@ describe "IO#eof?" do
|
|||
|
||||
it "returns false when not at end of file" do
|
||||
@io.read 1
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
end
|
||||
|
||||
it "returns true after reading with read with no parameters" do
|
||||
@io.read()
|
||||
@io.eof?.should == true
|
||||
@io.should.eof?
|
||||
end
|
||||
|
||||
it "returns true after reading with read" do
|
||||
@io.read(File.size(@name))
|
||||
@io.eof?.should == true
|
||||
@io.should.eof?
|
||||
end
|
||||
|
||||
it "returns true after reading with sysread" do
|
||||
@io.sysread(File.size(@name))
|
||||
@io.eof?.should == true
|
||||
@io.should.eof?
|
||||
end
|
||||
|
||||
it "returns true after reading with readlines" do
|
||||
@io.readlines
|
||||
@io.eof?.should == true
|
||||
@io.should.eof?
|
||||
end
|
||||
|
||||
it "returns false on just opened non-empty stream" do
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
end
|
||||
|
||||
it "does not consume the data from the stream" do
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
@io.getc.should == 'V'
|
||||
end
|
||||
|
||||
|
@ -78,7 +78,7 @@ describe "IO#eof?" do
|
|||
it "returns true on one-byte stream after single-byte read" do
|
||||
File.open(File.dirname(__FILE__) + '/fixtures/one_byte.txt') { |one_byte|
|
||||
one_byte.read(1)
|
||||
one_byte.eof?.should == true
|
||||
one_byte.should.eof?
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -92,16 +92,16 @@ describe "IO#eof?" do
|
|||
it "returns true on receiving side of Pipe when writing side is closed" do
|
||||
@r, @w = IO.pipe
|
||||
@w.close
|
||||
@r.eof?.should == true
|
||||
@r.should.eof?
|
||||
end
|
||||
|
||||
it "returns false on receiving side of Pipe when writing side wrote some data" do
|
||||
@r, @w = IO.pipe
|
||||
@w.puts "hello"
|
||||
@r.eof?.should == false
|
||||
@r.should_not.eof?
|
||||
@w.close
|
||||
@r.eof?.should == false
|
||||
@r.should_not.eof?
|
||||
@r.read
|
||||
@r.eof?.should == true
|
||||
@r.should.eof?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ describe "IO#gets" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "returns tainted strings" do
|
||||
while line = @io.gets
|
||||
line.tainted?.should == true
|
||||
line.should.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ describe "IO#gets" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "returns tainted strings" do
|
||||
while line = @io.gets(nil)
|
||||
line.tainted?.should == true
|
||||
line.should.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -103,7 +103,7 @@ describe "IO#gets" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "returns tainted strings" do
|
||||
while line = @io.gets("")
|
||||
line.tainted?.should == true
|
||||
line.should.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -129,7 +129,7 @@ describe "IO#gets" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "returns tainted strings" do
|
||||
while line = @io.gets("la")
|
||||
line.tainted?.should == true
|
||||
line.should.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,8 +44,8 @@ describe "IO.pipe" do
|
|||
r, w = IO.pipe do |_r, _w|
|
||||
[_r, _w]
|
||||
end
|
||||
r.closed?.should == true
|
||||
w.closed?.should == true
|
||||
r.should.closed?
|
||||
w.should.closed?
|
||||
end
|
||||
|
||||
it "closes both IO objects when the block raises" do
|
||||
|
@ -57,8 +57,8 @@ describe "IO.pipe" do
|
|||
raise RuntimeError
|
||||
end
|
||||
end.should raise_error(RuntimeError)
|
||||
r.closed?.should == true
|
||||
w.closed?.should == true
|
||||
r.should.closed?
|
||||
w.should.closed?
|
||||
end
|
||||
|
||||
it "allows IO objects to be closed within the block" do
|
||||
|
@ -67,8 +67,8 @@ describe "IO.pipe" do
|
|||
_w.close
|
||||
[_r, _w]
|
||||
end
|
||||
r.closed?.should == true
|
||||
w.closed?.should == true
|
||||
r.should.closed?
|
||||
w.should.closed?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,10 +77,10 @@ describe "IO.popen" do
|
|||
Process.kill "KILL", pid
|
||||
@io.close
|
||||
platform_is_not :windows do
|
||||
$?.signaled?.should == true
|
||||
$?.should.signaled?
|
||||
end
|
||||
platform_is :windows do
|
||||
$?.exited?.should == true
|
||||
$?.should.exited?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ describe "IO#read_nonblock" do
|
|||
require 'io/nonblock'
|
||||
@write.write "abc"
|
||||
@read.read_nonblock(1).should == "a"
|
||||
@read.nonblock?.should == true
|
||||
@read.should.nonblock?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ describe "IO#read" do
|
|||
|
||||
it "is at end-of-file when everything has been read" do
|
||||
@io.read
|
||||
@io.eof?.should == true
|
||||
@io.should.eof?
|
||||
end
|
||||
|
||||
it "reads the contents of a file" do
|
||||
|
|
|
@ -150,11 +150,11 @@ describe "IO#reopen with a String" do
|
|||
|
||||
@io.close_on_exec = true
|
||||
@io.reopen @other_name
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
|
||||
@io.close_on_exec = false
|
||||
@io.reopen @other_name
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "creates the file if it doesn't exist if the IO is opened in write mode" do
|
||||
|
@ -293,12 +293,12 @@ describe "IO#reopen with an IO" do
|
|||
@other_io.close_on_exec = true
|
||||
@io.close_on_exec = true
|
||||
@io.reopen @other_io
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
|
||||
@other_io.close_on_exec = false
|
||||
@io.close_on_exec = false
|
||||
@io.reopen @other_io
|
||||
@io.close_on_exec?.should == true
|
||||
@io.should.close_on_exec?
|
||||
end
|
||||
|
||||
it "may change the class of the instance" do
|
||||
|
|
|
@ -21,7 +21,7 @@ describe "IO#rewind" do
|
|||
it "positions the instance to the beginning of input and clears EOF" do
|
||||
value = @io.read
|
||||
@io.rewind
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
value.should == @io.read
|
||||
end
|
||||
|
||||
|
|
|
@ -44,21 +44,21 @@ describe "IO#seek" do
|
|||
it "moves the read position and clears EOF with SEEK_SET" do
|
||||
value = @io.read
|
||||
@io.seek(0, IO::SEEK_SET)
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
value.should == @io.read
|
||||
end
|
||||
|
||||
it "moves the read position and clears EOF with SEEK_CUR" do
|
||||
value = @io.read
|
||||
@io.seek(-1, IO::SEEK_CUR)
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
value[-1].should == @io.read[0]
|
||||
end
|
||||
|
||||
it "moves the read position and clears EOF with SEEK_END" do
|
||||
value = @io.read
|
||||
@io.seek(-1, IO::SEEK_END)
|
||||
@io.eof?.should == false
|
||||
@io.should_not.eof?
|
||||
value[-1].should == @io.read[0]
|
||||
end
|
||||
|
||||
|
|
|
@ -148,22 +148,22 @@ describe :io_new, shared: true do
|
|||
|
||||
it "sets binmode from mode string" do
|
||||
@io = IO.send(@method, @fd, 'wb')
|
||||
@io.binmode?.should == true
|
||||
@io.should.binmode?
|
||||
end
|
||||
|
||||
it "does not set binmode without being asked" do
|
||||
@io = IO.send(@method, @fd, 'w')
|
||||
@io.binmode?.should == false
|
||||
@io.should_not.binmode?
|
||||
end
|
||||
|
||||
it "sets binmode from :binmode option" do
|
||||
@io = IO.send(@method, @fd, 'w', binmode: true)
|
||||
@io.binmode?.should == true
|
||||
@io.should.binmode?
|
||||
end
|
||||
|
||||
it "does not set binmode from false :binmode" do
|
||||
@io = IO.send(@method, @fd, 'w', binmode: false)
|
||||
@io.binmode?.should == false
|
||||
@io.should_not.binmode?
|
||||
end
|
||||
|
||||
it "sets external encoding to binary with binmode in mode string" do
|
||||
|
@ -270,13 +270,13 @@ describe :io_new, shared: true do
|
|||
|
||||
it "accepts an :autoclose option" do
|
||||
@io = IO.send(@method, @fd, 'w', autoclose: false)
|
||||
@io.autoclose?.should == false
|
||||
@io.should_not.autoclose?
|
||||
@io.autoclose = true
|
||||
end
|
||||
|
||||
it "accepts any truthy option :autoclose" do
|
||||
@io = IO.send(@method, @fd, 'w', autoclose: 42)
|
||||
@io.autoclose?.should == true
|
||||
@io.should.autoclose?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ describe :io_pos, shared: true do
|
|||
io.read 1
|
||||
io.read 1
|
||||
io.send(@method)
|
||||
io.eof?.should == false
|
||||
io.should_not.eof?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,10 +74,10 @@ describe "IO#ungetc" do
|
|||
touch(@empty)
|
||||
|
||||
File.open(@empty) { |empty|
|
||||
empty.eof?.should == true
|
||||
empty.should.eof?
|
||||
empty.getc.should == nil
|
||||
empty.ungetc(100)
|
||||
empty.eof?.should == false
|
||||
empty.should_not.eof?
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ describe 'IO#write_nonblock' do
|
|||
it 'sets the IO in nonblock mode' do
|
||||
require 'io/nonblock'
|
||||
@write.write_nonblock('a')
|
||||
@write.nonblock?.should == true
|
||||
@write.should.nonblock?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,16 +40,16 @@ describe "Kernel#`" do
|
|||
ip = 'world'
|
||||
`echo disc #{ip}`
|
||||
$?.should be_kind_of(Process::Status)
|
||||
$?.stopped?.should == false
|
||||
$?.exited?.should == true
|
||||
$?.should_not.stopped?
|
||||
$?.should.exited?
|
||||
$?.exitstatus.should == 0
|
||||
$?.success?.should == true
|
||||
$?.should.success?
|
||||
`echo disc #{ip}; exit 99`
|
||||
$?.should be_kind_of(Process::Status)
|
||||
$?.stopped?.should == false
|
||||
$?.exited?.should == true
|
||||
$?.should_not.stopped?
|
||||
$?.should.exited?
|
||||
$?.exitstatus.should == 99
|
||||
$?.success?.should == false
|
||||
$?.should_not.success?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -58,16 +58,16 @@ describe "Kernel#`" do
|
|||
ip = 'world'
|
||||
`echo disc #{ip}`
|
||||
$?.should be_kind_of(Process::Status)
|
||||
$?.stopped?.should == false
|
||||
$?.exited?.should == true
|
||||
$?.should_not.stopped?
|
||||
$?.should.exited?
|
||||
$?.exitstatus.should == 0
|
||||
$?.success?.should == true
|
||||
$?.should.success?
|
||||
`echo disc #{ip}& exit 99`
|
||||
$?.should be_kind_of(Process::Status)
|
||||
$?.stopped?.should == false
|
||||
$?.exited?.should == true
|
||||
$?.should_not.stopped?
|
||||
$?.should.exited?
|
||||
$?.exitstatus.should == 99
|
||||
$?.success?.should == false
|
||||
$?.should_not.success?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe 'Kernel#caller_locations' do
|
|||
end
|
||||
|
||||
it 'returns an Array of caller locations' do
|
||||
KernelSpecs::CallerLocationsTest.locations.empty?.should == false
|
||||
KernelSpecs::CallerLocationsTest.locations.should_not.empty?
|
||||
end
|
||||
|
||||
it 'returns an Array of caller locations using a custom offset' do
|
||||
|
|
|
@ -7,7 +7,7 @@ describe 'Kernel#caller' do
|
|||
end
|
||||
|
||||
it 'returns an Array of caller locations' do
|
||||
KernelSpecs::CallerTest.locations.empty?.should == false
|
||||
KernelSpecs::CallerTest.locations.should_not.empty?
|
||||
end
|
||||
|
||||
it 'returns an Array of caller locations using a custom offset' do
|
||||
|
|
|
@ -33,22 +33,22 @@ describe "Kernel#clone" do
|
|||
@obj.freeze
|
||||
o3 = @obj.clone
|
||||
|
||||
o2.frozen?.should == false
|
||||
o3.frozen?.should == true
|
||||
o2.should_not.frozen?
|
||||
o3.should.frozen?
|
||||
end
|
||||
|
||||
ruby_version_is '2.8' do
|
||||
it 'takes an freeze: true option to frozen copy' do
|
||||
@obj.clone(freeze: true).frozen?.should == true
|
||||
@obj.clone(freeze: true).should.frozen?
|
||||
@obj.freeze
|
||||
@obj.clone(freeze: true).frozen?.should == true
|
||||
@obj.clone(freeze: true).should.frozen?
|
||||
end
|
||||
end
|
||||
|
||||
it 'takes an freeze: false option to not return frozen copy' do
|
||||
@obj.clone(freeze: false).frozen?.should == false
|
||||
@obj.clone(freeze: false).should_not.frozen?
|
||||
@obj.freeze
|
||||
@obj.clone(freeze: false).frozen?.should == false
|
||||
@obj.clone(freeze: false).should_not.frozen?
|
||||
end
|
||||
|
||||
it "copies instance variables" do
|
||||
|
|
|
@ -32,7 +32,7 @@ describe "Kernel#dup" do
|
|||
@obj.freeze
|
||||
dup = @obj.dup
|
||||
|
||||
dup.frozen?.should == false
|
||||
dup.should_not.frozen?
|
||||
end
|
||||
|
||||
it "copies instance variables" do
|
||||
|
|
|
@ -6,8 +6,8 @@ describe "Kernel#frozen?" do
|
|||
o = mock('o')
|
||||
p = mock('p')
|
||||
p.freeze
|
||||
o.frozen?.should == false
|
||||
p.frozen?.should == true
|
||||
o.should_not.frozen?
|
||||
p.should.frozen?
|
||||
end
|
||||
|
||||
describe "on true, false and nil" do
|
||||
|
|
|
@ -59,8 +59,8 @@ describe :kernel_dup_clone, shared: true do
|
|||
o.taint
|
||||
o3 = o.send(@method)
|
||||
|
||||
o2.tainted?.should == false
|
||||
o3.tainted?.should == true
|
||||
o2.should_not.tainted?
|
||||
o3.should.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -78,8 +78,8 @@ describe :kernel_dup_clone, shared: true do
|
|||
o.untrust
|
||||
o3 = o.send(@method)
|
||||
|
||||
o2.untrusted?.should == false
|
||||
o3.untrusted?.should == true
|
||||
o2.should_not.untrusted?
|
||||
o3.should.untrusted?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@ describe :kernel_system, shared: true do
|
|||
-> { @object.system("echo a") }.should output_to_fd("a\n")
|
||||
|
||||
$?.should be_an_instance_of Process::Status
|
||||
$?.success?.should == true
|
||||
$?.should.success?
|
||||
end
|
||||
|
||||
it "returns true when the command exits with a zero exit status" do
|
||||
@object.system(ruby_cmd('exit 0')).should == true
|
||||
|
||||
$?.should be_an_instance_of Process::Status
|
||||
$?.success?.should == true
|
||||
$?.should.success?
|
||||
$?.exitstatus.should == 0
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ describe :kernel_system, shared: true do
|
|||
@object.system(ruby_cmd('exit 1')).should == false
|
||||
|
||||
$?.should be_an_instance_of Process::Status
|
||||
$?.success?.should == false
|
||||
$?.should_not.success?
|
||||
$?.exitstatus.should == 1
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe "Kernel#taint" do
|
|||
it "sets the tainted bit" do
|
||||
o = Object.new
|
||||
o.taint
|
||||
o.tainted?.should == true
|
||||
o.should.tainted?
|
||||
end
|
||||
|
||||
it "raises FrozenError on an untainted, frozen object" do
|
||||
|
@ -27,20 +27,20 @@ describe "Kernel#taint" do
|
|||
it "has no effect on immediate values" do
|
||||
[nil, true, false].each do |v|
|
||||
v.taint
|
||||
v.tainted?.should == false
|
||||
v.should_not.tainted?
|
||||
end
|
||||
end
|
||||
|
||||
it "no raises a RuntimeError on symbols" do
|
||||
v = :sym
|
||||
-> { v.taint }.should_not raise_error(RuntimeError)
|
||||
v.tainted?.should == false
|
||||
v.should_not.tainted?
|
||||
end
|
||||
|
||||
it "no raises error on fixnum values" do
|
||||
[1].each do |v|
|
||||
-> { v.taint }.should_not raise_error(RuntimeError)
|
||||
v.tainted?.should == false
|
||||
v.should_not.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,8 @@ describe "Kernel#tainted?" do
|
|||
o = mock('o')
|
||||
p = mock('p')
|
||||
p.taint
|
||||
o.tainted?.should == false
|
||||
p.tainted?.should == true
|
||||
o.should_not.tainted?
|
||||
p.should.tainted?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe "Kernel#trust" do
|
|||
it "clears the untrusted bit" do
|
||||
o = Object.new.untrust
|
||||
o.trust
|
||||
o.untrusted?.should == false
|
||||
o.should_not.untrusted?
|
||||
end
|
||||
|
||||
it "raises FrozenError on an untrusted, frozen object" do
|
||||
|
|
|
@ -11,7 +11,7 @@ describe "Kernel#untaint" do
|
|||
it "clears the tainted bit" do
|
||||
o = Object.new.taint
|
||||
o.untaint
|
||||
o.tainted?.should == false
|
||||
o.should_not.tainted?
|
||||
end
|
||||
|
||||
it "raises FrozenError on a tainted, frozen object" do
|
||||
|
|
|
@ -11,7 +11,7 @@ describe "Kernel#untrust" do
|
|||
it "sets the untrusted bit" do
|
||||
o = Object.new
|
||||
o.untrust
|
||||
o.untrusted?.should == true
|
||||
o.should.untrusted?
|
||||
end
|
||||
|
||||
it "raises FrozenError on a trusted, frozen object" do
|
||||
|
|
|
@ -5,9 +5,9 @@ describe "Kernel#untrusted?" do
|
|||
ruby_version_is ''...'2.7' do
|
||||
it "returns the untrusted status of an object" do
|
||||
o = mock('o')
|
||||
o.untrusted?.should == false
|
||||
o.should_not.untrusted?
|
||||
o.untrust
|
||||
o.untrusted?.should == true
|
||||
o.should.untrusted?
|
||||
end
|
||||
|
||||
it "has no effect on immediate values" do
|
||||
|
@ -17,9 +17,9 @@ describe "Kernel#untrusted?" do
|
|||
a.untrust
|
||||
b.untrust
|
||||
c.untrust
|
||||
a.untrusted?.should == false
|
||||
b.untrusted?.should == false
|
||||
c.untrusted?.should == false
|
||||
a.should_not.untrusted?
|
||||
b.should_not.untrusted?
|
||||
c.should_not.untrusted?
|
||||
end
|
||||
|
||||
it "has effect on immediate values" do
|
||||
|
|
|
@ -9,7 +9,7 @@ describe "MatchData#string" do
|
|||
it "returns a frozen copy of the match string" do
|
||||
str = /(.)(.)(\d+)(\d)/.match("THX1138.").string
|
||||
str.should == "THX1138."
|
||||
str.frozen?.should == true
|
||||
str.should.frozen?
|
||||
end
|
||||
|
||||
it "returns the same frozen string for every call" do
|
||||
|
@ -20,6 +20,6 @@ describe "MatchData#string" do
|
|||
it "returns a frozen copy of the matched string for gsub(String)" do
|
||||
'he[[o'.gsub!('[', ']')
|
||||
$~.string.should == 'he[[o'
|
||||
$~.string.frozen?.should == true
|
||||
$~.string.should.frozen?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,8 +14,8 @@ describe "Math.tan" do
|
|||
end
|
||||
|
||||
it "returns NaN if called with +-Infinity" do
|
||||
Math.tan(infinity_value).nan?.should == true
|
||||
Math.tan(-infinity_value).nan?.should == true
|
||||
Math.tan(infinity_value).should.nan?
|
||||
Math.tan(-infinity_value).should.nan?
|
||||
end
|
||||
|
||||
it "raises a TypeError if the argument cannot be coerced with Float()" do
|
||||
|
|
|
@ -39,8 +39,8 @@ ruby_version_is "2.6" do
|
|||
double = proc { |x| x + x }
|
||||
|
||||
(pow_2 << double).is_a?(Proc).should == true
|
||||
ruby_version_is(''...'2.8') { (pow_2 << double).lambda?.should == true }
|
||||
ruby_version_is('2.8') { (pow_2 << double).lambda?.should == false }
|
||||
ruby_version_is(''...'2.8') { (pow_2 << double).should.lambda? }
|
||||
ruby_version_is('2.8') { (pow_2 << double).should_not.lambda? }
|
||||
end
|
||||
|
||||
it "may accept multiple arguments" do
|
||||
|
@ -88,7 +88,7 @@ ruby_version_is "2.6" do
|
|||
double = proc { |x| x + x }
|
||||
|
||||
(pow_2 >> double).is_a?(Proc).should == true
|
||||
(pow_2 >> double).lambda?.should == true
|
||||
(pow_2 >> double).should.lambda?
|
||||
end
|
||||
|
||||
it "may accept multiple arguments" do
|
||||
|
|
|
@ -39,6 +39,6 @@ describe "Module#included" do
|
|||
|
||||
it "works with super using a singleton class" do
|
||||
ModuleSpecs::SingletonOnModuleCase::Bar.include ModuleSpecs::SingletonOnModuleCase::Foo
|
||||
ModuleSpecs::SingletonOnModuleCase::Bar.included_called?.should == true
|
||||
ModuleSpecs::SingletonOnModuleCase::Bar.should.included_called?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -122,7 +122,7 @@ describe "Module#name" do
|
|||
|
||||
ruby_version_is "2.7" do
|
||||
it "returns a frozen String" do
|
||||
ModuleSpecs.name.frozen?.should == true
|
||||
ModuleSpecs.name.should.frozen?
|
||||
end
|
||||
|
||||
it "always returns the same String for a given Module" do
|
||||
|
|
|
@ -3,25 +3,25 @@ require_relative '../../spec_helper'
|
|||
describe "Module#singleton_class?" do
|
||||
it "returns true for singleton classes" do
|
||||
xs = self.singleton_class
|
||||
xs.singleton_class?.should == true
|
||||
xs.should.singleton_class?
|
||||
end
|
||||
|
||||
it "returns false for other classes" do
|
||||
c = Class.new
|
||||
c.singleton_class?.should == false
|
||||
c.should_not.singleton_class?
|
||||
end
|
||||
|
||||
describe "with singleton values" do
|
||||
it "returns false for nil's singleton class" do
|
||||
NilClass.singleton_class?.should == false
|
||||
NilClass.should_not.singleton_class?
|
||||
end
|
||||
|
||||
it "returns false for true's singleton class" do
|
||||
TrueClass.singleton_class?.should == false
|
||||
TrueClass.should_not.singleton_class?
|
||||
end
|
||||
|
||||
it "returns false for false's singleton class" do
|
||||
FalseClass.singleton_class?.should == false
|
||||
FalseClass.should_not.singleton_class?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "NilClass#nil?" do
|
||||
it "returns true" do
|
||||
nil.nil?.should == true
|
||||
nil.should.nil?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe "NilClass#to_s" do
|
|||
|
||||
ruby_version_is "2.7" do
|
||||
it "returns a frozen string" do
|
||||
nil.to_s.frozen?.should == true
|
||||
nil.to_s.should.frozen?
|
||||
end
|
||||
|
||||
it "always returns the same string" do
|
||||
|
|
|
@ -3,6 +3,6 @@ require_relative 'fixtures/classes'
|
|||
|
||||
describe "Numeric#integer?" do
|
||||
it "returns false" do
|
||||
NumericSpecs::Subclass.new.integer?.should == false
|
||||
NumericSpecs::Subclass.new.should_not.integer?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,11 +31,11 @@ describe "Numeric#negative?" do
|
|||
|
||||
it "returns true if self is less than 0" do
|
||||
@obj.should_receive(:<).with(0).and_return(true)
|
||||
@obj.negative?.should == true
|
||||
@obj.should.negative?
|
||||
end
|
||||
|
||||
it "returns false if self is greater than 0" do
|
||||
@obj.should_receive(:<).with(0).and_return(false)
|
||||
@obj.negative?.should == false
|
||||
@obj.should_not.negative?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,11 +31,11 @@ describe "Numeric#positive?" do
|
|||
|
||||
it "returns true if self is greater than 0" do
|
||||
@obj.should_receive(:>).with(0).and_return(true)
|
||||
@obj.positive?.should == true
|
||||
@obj.should.positive?
|
||||
end
|
||||
|
||||
it "returns false if self is less than 0" do
|
||||
@obj.should_receive(:>).with(0).and_return(false)
|
||||
@obj.positive?.should == false
|
||||
@obj.should_not.positive?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,6 @@ end
|
|||
|
||||
describe "Numeric#real?" do
|
||||
it "returns true" do
|
||||
NumericSpecs::Subclass.new.real?.should == true
|
||||
NumericSpecs::Subclass.new.should.real?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,11 +8,11 @@ describe "Numeric#zero?" do
|
|||
|
||||
it "returns true if self is 0" do
|
||||
@obj.should_receive(:==).with(0).and_return(true)
|
||||
@obj.zero?.should == true
|
||||
@obj.should.zero?
|
||||
end
|
||||
|
||||
it "returns false if self is not 0" do
|
||||
@obj.should_receive(:==).with(0).and_return(false)
|
||||
@obj.zero?.should == false
|
||||
@obj.should_not.zero?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ ruby_version_is "2.6" do
|
|||
g = proc { |x| x + x }
|
||||
|
||||
(f << g).is_a?(Proc).should == true
|
||||
(f << g).lambda?.should == false
|
||||
(f << g).should_not.lambda?
|
||||
end
|
||||
|
||||
ruby_version_is(''...'2.8') do
|
||||
|
@ -44,7 +44,7 @@ ruby_version_is "2.6" do
|
|||
g = -> x { x + x }
|
||||
|
||||
(f << g).is_a?(Proc).should == true
|
||||
(f << g).lambda?.should == false
|
||||
(f << g).should_not.lambda?
|
||||
end
|
||||
|
||||
it "is a lambda when self is lambda" do
|
||||
|
@ -52,7 +52,7 @@ ruby_version_is "2.6" do
|
|||
g = proc { |x| x + x }
|
||||
|
||||
(f << g).is_a?(Proc).should == true
|
||||
(f << g).lambda?.should == true
|
||||
(f << g).should.lambda?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -63,8 +63,8 @@ ruby_version_is "2.6" do
|
|||
lambda_proc = -> x { x }
|
||||
|
||||
(f << g).is_a?(Proc).should == true
|
||||
(f << g).lambda?.should == false
|
||||
(f << lambda_proc).lambda?.should == true
|
||||
(f << g).should_not.lambda?
|
||||
(f << lambda_proc).should.lambda?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,7 +118,7 @@ ruby_version_is "2.6" do
|
|||
g = proc { |x| x + x }
|
||||
|
||||
(f >> g).is_a?(Proc).should == true
|
||||
(f >> g).lambda?.should == false
|
||||
(f >> g).should_not.lambda?
|
||||
end
|
||||
|
||||
it "is a Proc when other is lambda" do
|
||||
|
@ -126,7 +126,7 @@ ruby_version_is "2.6" do
|
|||
g = -> x { x + x }
|
||||
|
||||
(f >> g).is_a?(Proc).should == true
|
||||
(f >> g).lambda?.should == false
|
||||
(f >> g).should_not.lambda?
|
||||
end
|
||||
|
||||
it "is a lambda when self is lambda" do
|
||||
|
@ -134,7 +134,7 @@ ruby_version_is "2.6" do
|
|||
g = proc { |x| x + x }
|
||||
|
||||
(f >> g).is_a?(Proc).should == true
|
||||
(f >> g).lambda?.should == true
|
||||
(f >> g).should.lambda?
|
||||
end
|
||||
|
||||
it "may accept multiple arguments" do
|
||||
|
|
|
@ -5,11 +5,11 @@ describe "Range#dup" do
|
|||
copy = (1..3).dup
|
||||
copy.begin.should == 1
|
||||
copy.end.should == 3
|
||||
copy.exclude_end?.should == false
|
||||
copy.should_not.exclude_end?
|
||||
|
||||
copy = ("a"..."z").dup
|
||||
copy.begin.should == "a"
|
||||
copy.end.should == "z"
|
||||
copy.exclude_end?.should == true
|
||||
copy.should.exclude_end?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,18 +2,18 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Range#exclude_end?" do
|
||||
it "returns false if the range does not exclude the end value" do
|
||||
(-2..2).exclude_end?.should == false
|
||||
('A'..'B').exclude_end?.should == false
|
||||
(0.5..2.4).exclude_end?.should == false
|
||||
(0xfffd..0xffff).exclude_end?.should == false
|
||||
Range.new(0, 1).exclude_end?.should == false
|
||||
(-2..2).should_not.exclude_end?
|
||||
('A'..'B').should_not.exclude_end?
|
||||
(0.5..2.4).should_not.exclude_end?
|
||||
(0xfffd..0xffff).should_not.exclude_end?
|
||||
Range.new(0, 1).should_not.exclude_end?
|
||||
end
|
||||
|
||||
it "returns true if the range excludes the end value" do
|
||||
(0...5).exclude_end?.should == true
|
||||
('A'...'B').exclude_end?.should == true
|
||||
(0.5...2.4).exclude_end?.should == true
|
||||
(0xfffd...0xffff).exclude_end?.should == true
|
||||
Range.new(0, 1, true).exclude_end?.should == true
|
||||
(0...5).should.exclude_end?
|
||||
('A'...'B').should.exclude_end?
|
||||
(0.5...2.4).should.exclude_end?
|
||||
(0xfffd...0xffff).should.exclude_end?
|
||||
Range.new(0, 1, true).should.exclude_end?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require_relative '../../spec_helper'
|
|||
|
||||
describe "Regexp#casefold?" do
|
||||
it "returns the value of the case-insensitive flag" do
|
||||
/abc/i.casefold?.should == true
|
||||
/xyz/.casefold?.should == false
|
||||
/abc/i.should.casefold?
|
||||
/xyz/.should_not.casefold?
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue