1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-09-29 19:13:37 +02:00
parent d51b4e34fb
commit 070cbe22b7
35 changed files with 127 additions and 133 deletions

View file

@ -95,8 +95,8 @@ describe "Dir.chdir" do
it "raises an Errno::ENOENT if the original directory no longer exists" do
dir1 = tmp('/testdir1')
dir2 = tmp('/testdir2')
File.exist?(dir1).should == false
File.exist?(dir2).should == false
File.should_not.exist?(dir1)
File.should_not.exist?(dir2)
Dir.mkdir dir1
Dir.mkdir dir2
begin

View file

@ -14,9 +14,9 @@ describe "Dir.mkdir" do
DirSpecs.clear_dirs
begin
File.exist?('nonexisting').should == false
File.should_not.exist?('nonexisting')
Dir.mkdir 'nonexisting'
File.exist?('nonexisting').should == true
File.should.exist?('nonexisting')
platform_is_not :windows do
Dir.mkdir 'default_perms'
a = File.stat('default_perms').mode

View file

@ -16,7 +16,7 @@ describe :dir_chroot_as_root, shared: true do
it "can be used to change the process' root directory" do
-> { Dir.send(@method, File.dirname(__FILE__)) }.should_not raise_error
File.exist?("/#{File.basename(__FILE__)}").should be_true
File.should.exist?("/#{File.basename(__FILE__)}")
end
it "returns 0 if successful" do
@ -29,8 +29,8 @@ describe :dir_chroot_as_root, shared: true do
it "can be escaped from with ../" do
Dir.send(@method, @real_root)
File.exist?(@ref_dir).should be_true
File.exist?("/#{File.basename(__FILE__)}").should be_false
File.should.exist?(@ref_dir)
File.should_not.exist?("/#{File.basename(__FILE__)}")
end
it "calls #to_path on non-String argument" do

View file

@ -39,7 +39,7 @@ describe :dir_exist, shared: true do
end
it "returns false if the argument exists but is a file" do
File.exist?(__FILE__).should be_true
File.should.exist?(__FILE__)
Dir.send(@method, __FILE__).should be_false
end

View file

@ -331,14 +331,14 @@ describe :dir_glob, shared: true do
it "returns [] if specified path does not exist" do
path = File.join(@mock_dir, "fake-name")
File.exist?(path).should == false
File.should_not.exist?(path)
Dir.send(@method, "*", base: path).should == []
end
it "returns [] if specified path is a file" do
path = File.join(@mock_dir, "a/b/x")
File.exist?(path).should == true
File.should.exist?(path)
Dir.send(@method, "*", base: path).should == []
end

View file

@ -16,7 +16,7 @@ describe "File.link" do
platform_is_not :windows do
it "link a file with another" do
File.link(@file, @link).should == 0
File.exist?(@link).should == true
File.should.exist?(@link)
File.identical?(@file, @link).should == true
end

View file

@ -17,13 +17,13 @@ describe "File.new" do
it "returns a new File with mode string" do
@fh = File.new(@file, 'w')
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "returns a new File with mode num" do
@fh = File.new(@file, @flags)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "returns a new File with modus num and permissions" do
@ -34,7 +34,7 @@ describe "File.new" do
platform_is_not :windows do
File.stat(@file).mode.to_s(8).should == "100744"
end
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "creates the file and returns writable descriptor when called with 'w' mode and r-o permissions" do
@ -48,7 +48,7 @@ describe "File.new" do
ensure
f.close
end
File.exist?(@file).should == true
File.should.exist?(@file)
File.read(@file).should == "test\n"
end
@ -75,13 +75,13 @@ describe "File.new" do
fh_copy = File.new(@fh.fileno)
fh_copy.autoclose = false
fh_copy.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "creates a new file when use File::EXCL mode" do
@fh = File.new(@file, File::EXCL)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "raises an Errorno::EEXIST if the file exists when create a new file with File::CREAT|File::EXCL" do
@ -91,46 +91,46 @@ describe "File.new" do
it "creates a new file when use File::WRONLY|File::APPEND mode" do
@fh = File.new(@file, File::WRONLY|File::APPEND)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "returns a new File when use File::APPEND mode" do
@fh = File.new(@file, File::APPEND)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "returns a new File when use File::RDONLY|File::APPEND mode" do
@fh = File.new(@file, File::RDONLY|File::APPEND)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "returns a new File when use File::RDONLY|File::WRONLY mode" do
@fh = File.new(@file, File::RDONLY|File::WRONLY)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "creates a new file when use File::WRONLY|File::TRUNC mode" do
@fh = File.new(@file, File::WRONLY|File::TRUNC)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "coerces filename using to_str" do
name = mock("file")
name.should_receive(:to_str).and_return(@file)
@fh = File.new(name, "w")
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "coerces filename using #to_path" do
name = mock("file")
name.should_receive(:to_path).and_return(@file)
@fh = File.new(name, "w")
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "raises a TypeError if the first parameter can't be coerced to a string" do

View file

@ -63,40 +63,40 @@ describe "File.open" do
it "opens the file (basic case)" do
@fh = File.open(@file)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens the file with unicode characters" do
@fh = File.open(@unicode_path, "w")
@fh.should be_kind_of(File)
File.exist?(@unicode_path).should == true
File.should.exist?(@unicode_path)
end
it "opens a file when called with a block" do
File.open(@file) { |fh| }
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens with mode string" do
@fh = File.open(@file, 'w')
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file with mode string and block" do
File.open(@file, 'w') { |fh| }
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file with mode num" do
@fh = File.open(@file, @flags)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file with mode num and block" do
File.open(@file, 'w') { |fh| }
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file with mode and permission as nil" do
@ -113,7 +113,7 @@ describe "File.open" do
platform_is_not :windows do
@fh.lstat.mode.to_s(8).should == "100744"
end
File.exist?(@file).should == true
File.should.exist?(@file)
end
# For this test we delete the file first to reset the perms
@ -124,7 +124,7 @@ describe "File.open" do
platform_is_not :windows do
File.stat(@file).mode.to_s(8).should == "100755"
end
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "creates the file and returns writable descriptor when called with 'w' mode and r-o permissions" do
@ -162,7 +162,7 @@ describe "File.open" do
fh_copy = File.open(@fh.fileno)
fh_copy.autoclose = false
fh_copy.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file that no exists when use File::WRONLY mode" do
@ -206,19 +206,19 @@ describe "File.open" do
it "opens a file that no exists when use File::CREAT mode" do
@fh = File.open(@nonexistent, File::CREAT) { |f| f }
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file that no exists when use 'a' mode" do
@fh = File.open(@nonexistent, 'a') { |f| f }
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file that no exists when use 'w' mode" do
@fh = File.open(@nonexistent, 'w') { |f| f }
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
# Check the grants associated to the different open modes combinations.
@ -365,7 +365,7 @@ describe "File.open" do
it "creates a new file when use File::WRONLY|File::APPEND mode" do
@fh = File.open(@file, File::WRONLY|File::APPEND)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file when use File::WRONLY|File::APPEND mode" do
@ -408,7 +408,7 @@ describe "File.open" do
begin
@fh = File.open(@file, File::WRONLY|File::TRUNC)
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
ensure
fh1.close
end
@ -471,13 +471,13 @@ describe "File.open" do
it "opens a file for binary read" do
@fh = File.open(@file, "rb")
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file for binary write" do
@fh = File.open(@file, "wb")
@fh.should be_kind_of(File)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "opens a file for read-write and truncate the file" do
@ -523,10 +523,10 @@ describe "File.open" do
io.read.should == "ruby"
Dir["#{dir}/*"].should == []
end
rescue Errno::EOPNOTSUPP, Errno::EINVAL, Errno::EISDIR
# EOPNOTSUPP: no support from the filesystem
# EINVAL: presumably bug in glibc
1.should == 1
rescue Errno::EOPNOTSUPP
skip "no support from the filesystem"
rescue Errno::EINVAL, Errno::EISDIR
skip "presumably bug in glibc"
ensure
rm_r dir
end

View file

@ -14,11 +14,11 @@ describe "File.rename" do
end
it "renames a file" do
File.exist?(@old).should == true
File.exist?(@new).should == false
File.should.exist?(@old)
File.should_not.exist?(@new)
File.rename(@old, @new)
File.exist?(@old).should == false
File.exist?(@new).should == true
File.should_not.exist?(@old)
File.should.exist?(@new)
end
it "raises an Errno::ENOENT if the source does not exist" do

View file

@ -68,8 +68,7 @@ describe :file_path, shared: true do
-> { f.send(@method) }.should raise_error(IOError)
end
rescue Errno::EOPNOTSUPP, Errno::EINVAL, Errno::EISDIR
# EOPNOTSUPP: no support from the filesystem
1.should == 1
skip "no support from the filesystem"
end
end
end

View file

@ -21,13 +21,13 @@ describe :file_unlink, shared: true do
it "deletes a single file" do
File.send(@method, @file1).should == 1
File.exist?(@file1).should == false
File.should_not.exist?(@file1)
end
it "deletes multiple files" do
File.send(@method, @file1, @file2).should == 2
File.exist?(@file1).should == false
File.exist?(@file2).should == false
File.should_not.exist?(@file1)
File.should_not.exist?(@file2)
end
it "raises a TypeError if not passed a String type" do
@ -52,10 +52,10 @@ describe :file_unlink, shared: true do
it "allows deleting an open file with File::SHARE_DELETE" do
path = tmp("share_delete.txt")
File.open(path, mode: File::CREAT | File::WRONLY | File::BINARY | File::SHARE_DELETE) do |f|
File.exist?(path).should be_true
File.should.exist?(path)
File.send(@method, path)
end
File.exist?(path).should be_false
File.should_not.exist?(path)
end
end
end

View file

@ -6,7 +6,7 @@ describe "File.world_readable?" do
it "returns nil if the file does not exist" do
file = rand.to_s + $$.to_s
File.exist?(file).should be_false
File.should_not.exist?(file)
File.world_readable?(file).should be_nil
end
end

View file

@ -6,7 +6,7 @@ describe "File.world_writable?" do
it "returns nil if the file does not exist" do
file = rand.to_s + $$.to_s
File.exist?(file).should be_false
File.should_not.exist?(file)
File.world_writable?(file).should be_nil
end
end

View file

@ -82,8 +82,7 @@ describe "IO#advise" do
`uname -r`.chomp
end
if (uname.split('.').map(&:to_i) <=> [3,6]) < 0
# [ruby-core:65355] tmpfs is not supported
1.should == 1
skip "[ruby-core:65355] tmpfs is not supported"
else
@io.advise(:willneed).should be_nil
end

View file

@ -161,14 +161,14 @@ describe "IO#reopen with a String" do
@io = new_io @name, "w"
@io.reopen(@other_name)
File.exist?(@other_name).should be_true
File.should.exist?(@other_name)
end
it "creates the file if it doesn't exist if the IO is opened in write mode" do
@io = new_io @name, "a"
@io.reopen(@other_name)
File.exist?(@other_name).should be_true
File.should.exist?(@other_name)
end
end

View file

@ -24,9 +24,9 @@ describe :io_binwrite, shared: true do
it "creates a file if missing" do
fn = @filename + "xxx"
begin
File.exist?(fn).should be_false
File.should_not.exist?(fn)
IO.send(@method, fn, "test")
File.exist?(fn).should be_true
File.should.exist?(fn)
ensure
rm_r fn
end
@ -35,9 +35,9 @@ describe :io_binwrite, shared: true do
it "creates file if missing even if offset given" do
fn = @filename + "xxx"
begin
File.exist?(fn).should be_false
File.should_not.exist?(fn)
IO.send(@method, fn, "test", 0)
File.exist?(fn).should be_true
File.should.exist?(fn)
ensure
rm_r fn
end

View file

@ -7,8 +7,7 @@ describe :io_tty, shared: true do
# check to enabled tty
File.open('/dev/tty') {}
rescue Errno::ENXIO
# workaround for not configured environment like OS X
1.should == 1
skip "workaround for not configured environment like OS X"
else
File.open('/dev/tty') { |f| f.send(@method) }.should == true
end

View file

@ -68,8 +68,10 @@ describe 'IO#write_nonblock' do
context "when exception option is set to false" do
it "returns :wait_writable when the operation would block" do
loop { break if @write.write_nonblock("a" * 10_000, exception: false) == :wait_writable }
1.should == 1
loop {
break if @write.write_nonblock("a" * 10_000, exception: false) == :wait_writable
}
@write.write_nonblock("a" * 10_000, exception: false).should == :wait_writable
end
end

View file

@ -13,7 +13,7 @@ describe 'Kernel#caller_locations' do
it 'returns an Array of caller locations using a custom offset' do
locations = KernelSpecs::CallerLocationsTest.locations(2)
locations[0].absolute_path.end_with?('mspec.rb').should == true
locations[0].absolute_path.should.end_with?('mspec.rb')
end
it 'returns an Array of caller locations using a custom limit' do

View file

@ -20,7 +20,7 @@ describe :kernel_require_basic, shared: true do
it "raises a LoadError if the file does not exist" do
path = File.expand_path "nonexistent.rb", CODE_LOADING_DIR
File.exist?(path).should be_false
File.should_not.exist?(path)
-> { @object.send(@method, path) }.should raise_error(LoadError)
ScratchPad.recorded.should == []
end
@ -41,7 +41,7 @@ describe :kernel_require_basic, shared: true do
end
it "raises a LoadError" do
File.exist?(@path).should be_true
File.should.exist?(@path)
-> { @object.send(@method, @path) }.should raise_error(LoadError)
end
end
@ -247,7 +247,7 @@ describe :kernel_require, shared: true do
describe "(file extensions)" do
it "loads a .rb extensioned file when passed a non-extensioned path" do
path = File.expand_path "load_fixture", CODE_LOADING_DIR
File.exist?(path).should be_true
File.should.exist?(path)
@object.require(path).should be_true
ScratchPad.recorded.should == [:loaded]
end
@ -271,7 +271,7 @@ describe :kernel_require, shared: true do
it "loads a .rb extensioned file when passed a non-.rb extensioned path" do
path = File.expand_path "load_fixture.ext", CODE_LOADING_DIR
File.exist?(path).should be_true
File.should.exist?(path)
@object.require(path).should be_true
ScratchPad.recorded.should == [:loaded]
end

View file

@ -388,8 +388,8 @@ describe "String#dump" do
end
it "includes .force_encoding(name) if the encoding isn't ASCII compatible" do
"\u{876}".encode('utf-16be').dump.end_with?(".force_encoding(\"UTF-16BE\")").should be_true
"\u{876}".encode('utf-16le').dump.end_with?(".force_encoding(\"UTF-16LE\")").should be_true
"\u{876}".encode('utf-16be').dump.should.end_with?(".force_encoding(\"UTF-16BE\")")
"\u{876}".encode('utf-16le').dump.should.end_with?(".force_encoding(\"UTF-16LE\")")
end
it "keeps origin encoding" do

View file

@ -5,33 +5,33 @@ require_relative 'fixtures/classes'
describe "String#end_with?" do
it "returns true only if ends match" do
s = "hello"
s.end_with?('o').should be_true
s.end_with?('llo').should be_true
s.should.end_with?('o')
s.should.end_with?('llo')
end
it 'returns false if the end does not match' do
s = 'hello'
s.end_with?('ll').should be_false
s.should_not.end_with?('ll')
end
it "returns true if the search string is empty" do
"hello".end_with?("").should be_true
"".end_with?("").should be_true
"hello".should.end_with?("")
"".should.end_with?("")
end
it "returns true only if any ending match" do
"hello".end_with?('x', 'y', 'llo', 'z').should be_true
"hello".should.end_with?('x', 'y', 'llo', 'z')
end
it "converts its argument using :to_str" do
s = "hello"
find = mock('o')
find.should_receive(:to_str).and_return("o")
s.end_with?(find).should be_true
s.should.end_with?(find)
end
it "ignores arguments not convertible to string" do
"hello".end_with?().should be_false
"hello".should_not.end_with?()
-> { "hello".end_with?(1) }.should raise_error(TypeError)
-> { "hello".end_with?(["o"]) }.should raise_error(TypeError)
-> { "hello".end_with?(1, nil, "o") }.should raise_error(TypeError)
@ -40,11 +40,11 @@ describe "String#end_with?" do
it "uses only the needed arguments" do
find = mock('h')
find.should_not_receive(:to_str)
"hello".end_with?("o",find).should be_true
"hello".should.end_with?("o",find)
end
it "works for multibyte strings" do
"céréale".end_with?("réale").should be_true
"céréale".should.end_with?("réale")
end
it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
@ -53,5 +53,4 @@ describe "String#end_with?" do
"あれ".end_with?(pat)
end.should raise_error(Encoding::CompatibilityError)
end
end

View file

@ -5,29 +5,29 @@ require_relative 'fixtures/classes'
describe "String#start_with?" do
it "returns true only if beginning match" do
s = "hello"
s.start_with?('h').should be_true
s.start_with?('hel').should be_true
s.start_with?('el').should be_false
s.should.start_with?('h')
s.should.start_with?('hel')
s.should_not.start_with?('el')
end
it "returns true only if any beginning match" do
"hello".start_with?('x', 'y', 'he', 'z').should be_true
"hello".should.start_with?('x', 'y', 'he', 'z')
end
it "returns true if the search string is empty" do
"hello".start_with?("").should be_true
"".start_with?("").should be_true
"hello".should.start_with?("")
"".should.start_with?("")
end
it "converts its argument using :to_str" do
s = "hello"
find = mock('h')
find.should_receive(:to_str).and_return("h")
s.start_with?(find).should be_true
s.should.start_with?(find)
end
it "ignores arguments not convertible to string" do
"hello".start_with?().should be_false
"hello".should_not.start_with?()
-> { "hello".start_with?(1) }.should raise_error(TypeError)
-> { "hello".start_with?(["h"]) }.should raise_error(TypeError)
-> { "hello".start_with?(1, nil, "h") }.should raise_error(TypeError)
@ -36,29 +36,29 @@ describe "String#start_with?" do
it "uses only the needed arguments" do
find = mock('h')
find.should_not_receive(:to_str)
"hello".start_with?("h",find).should be_true
"hello".should.start_with?("h",find)
end
it "works for multibyte strings" do
"céréale".start_with?("cér").should be_true
"céréale".should.start_with?("cér")
end
ruby_version_is "2.5" do
it "supports regexps" do
regexp = /[h1]/
"hello".start_with?(regexp).should be_true
"1337".start_with?(regexp).should be_true
"foxes are 1337".start_with?(regexp).should be_false
"chunky\n12bacon".start_with?(/12/).should be_false
"hello".should.start_with?(regexp)
"1337".should.start_with?(regexp)
"foxes are 1337".should_not.start_with?(regexp)
"chunky\n12bacon".should_not.start_with?(/12/)
end
it "supports regexps with ^ and $ modifiers" do
regexp1 = /^\d{2}/
regexp2 = /\d{2}$/
"12test".start_with?(regexp1).should be_true
"test12".start_with?(regexp1).should be_false
"12test".start_with?(regexp2).should be_false
"test12".start_with?(regexp2).should be_false
"12test".should.start_with?(regexp1)
"test12".should_not.start_with?(regexp1)
"12test".should_not.start_with?(regexp2)
"test12".should_not.start_with?(regexp2)
end
it "sets Regexp.last_match if it returns true" do

View file

@ -31,7 +31,7 @@ describe "Logger::LogDevice#new" do
l.write("Test message")
l.close
File.exist?(path).should be_true
File.should.exist?(path)
File.open(path) do |f|
f.readlines.should_not be_empty
end

View file

@ -46,8 +46,8 @@ describe "Logger#new" do
l.add Logger::WARN, "foo"
l.add Logger::WARN, "bar"
File.exist?(path).should be_true
File.exist?(path + ".0").should be_true
File.should.exist?(path)
File.should.exist?(path + ".0")
# first line will be a comment so we'll have to skip it.
f = File.open(path)
@ -108,7 +108,7 @@ describe "Logger#new" do
shifted_path = "#{path}.#{now.strftime(shift_period_suffix)}"
File.exist?(shifted_path).should == true
File.should.exist?(shifted_path)
logger.close

View file

@ -14,13 +14,13 @@ describe 'RbConfig::CONFIG' do
it "['rubylibdir'] returns the directory containing Ruby standard libraries" do
rubylibdir = RbConfig::CONFIG['rubylibdir']
File.directory?(rubylibdir).should == true
File.exist?("#{rubylibdir}/fileutils.rb").should == true
File.should.exist?("#{rubylibdir}/fileutils.rb")
end
it "['archdir'] returns the directory containing standard libraries C extensions" do
archdir = RbConfig::CONFIG['archdir']
File.directory?(archdir).should == true
File.exist?("#{archdir}/etc.#{RbConfig::CONFIG['DLEXT']}").should == true
File.should.exist?("#{archdir}/etc.#{RbConfig::CONFIG['DLEXT']}")
end
end
end

View file

@ -20,16 +20,13 @@ describe "Gem.bin_path" do
default_specifications_dir = Gem::Specification.default_specifications_dir
end
if Dir.exist?(default_specifications_dir)
Gem::Specification.each_spec([default_specifications_dir]) do |spec|
spec.executables.each do |exe|
path = Gem.bin_path(spec.name, exe)
File.should.exist?(path)
end
skip "Could not find the default gemspecs" unless Dir.exist?(default_specifications_dir)
Gem::Specification.each_spec([default_specifications_dir]) do |spec|
spec.executables.each do |exe|
path = Gem.bin_path(spec.name, exe)
File.should.exist?(path)
end
else
# non-installed MRI, there are no default gemspecs
1.should == 1
end
end
end

View file

@ -18,7 +18,7 @@ describe "Tempfile#close when passed no argument or [false]" do
it "does not unlink self" do
path = @tempfile.path
@tempfile.close
File.exist?(path).should be_true
File.should.exist?(path)
end
end
@ -35,7 +35,7 @@ describe "Tempfile#close when passed [true]" do
it "unlinks self" do
path = @tempfile.path
@tempfile.close(true)
File.exist?(path).should be_false
File.should_not.exist?(path)
end
end
@ -52,6 +52,6 @@ describe "Tempfile#close!" do
it "unlinks self" do
path = @tempfile.path
@tempfile.close!
File.exist?(path).should be_false
File.should_not.exist?(path)
end
end

View file

@ -12,7 +12,7 @@ describe "Tempfile#initialize" do
it "opens a new tempfile with the passed name in the passed directory" do
@tempfile.send(:initialize, "basename", tmp(""))
File.exist?(@tempfile.path).should be_true
File.should.exist?(@tempfile.path)
tmpdir = tmp("")
path = @tempfile.path

View file

@ -7,6 +7,6 @@ describe :tempfile_unlink, shared: true do
@tempfile.close
path = @tempfile.path
@tempfile.send(@method)
File.exist?(path).should be_false
File.should_not.exist?(path)
end
end

View file

@ -39,7 +39,7 @@ describe "Dir.mktmpdir when passed a block" do
Dir.mktmpdir do |path|
@tmpdir = path
called = true
path.start_with?(@real_tmp_root).should be_true
path.should.start_with?(@real_tmp_root)
end
called.should be_true
end

View file

@ -26,8 +26,7 @@ describe :file_grpowned, shared: true do
@object.send(@method, @file).should == true
else
# No supplementary groups
1.should == 1
skip "No supplementary groups"
end
end
end

View file

@ -37,7 +37,7 @@ describe :file_world_readable, shared: true do
it "returns a Fixnum if the file is a directory and chmod 644" do
dir = rand().to_s + '-ww'
Dir.mkdir(dir)
Dir.exist?(dir).should be_true
Dir.should.exist?(dir)
File.chmod(0644, dir)
@object.world_readable?(dir).should be_an_instance_of(Fixnum)
Dir.rmdir(dir)

View file

@ -36,7 +36,7 @@ describe :file_world_writable, shared: true do
it "returns a Fixnum if the file is a directory and chmod 777" do
dir = rand().to_s + '-ww'
Dir.mkdir(dir)
Dir.exist?(dir).should be_true
Dir.should.exist?(dir)
File.chmod(0777, dir)
@object.world_writable?(dir).should be_an_instance_of(Fixnum)
Dir.rmdir(dir)

View file

@ -60,7 +60,7 @@ describe :process_fork, shared: true do
else
Process.waitpid(child_id)
end
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "runs a block in a child process" do
@ -69,7 +69,7 @@ describe :process_fork, shared: true do
Process.exit!
}
Process.waitpid(pid)
File.exist?(@file).should == true
File.should.exist?(@file)
end
it "marks threads from the parent as killed" do