summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-09-29 19:13:37 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-09-29 19:13:37 +0200
commit070cbe22b70ec2bec36c7cfc84b726510afa306f (patch)
tree56cee87834c85bd9f358ebee51bab4893fb9952f
parentd51b4e34fbdbe1a845aa2251b1fa3304de809b32 (diff)
Update to ruby/spec@34e6246
-rw-r--r--spec/ruby/core/dir/chdir_spec.rb4
-rw-r--r--spec/ruby/core/dir/mkdir_spec.rb4
-rw-r--r--spec/ruby/core/dir/shared/chroot.rb6
-rw-r--r--spec/ruby/core/dir/shared/exist.rb2
-rw-r--r--spec/ruby/core/dir/shared/glob.rb4
-rw-r--r--spec/ruby/core/file/link_spec.rb2
-rw-r--r--spec/ruby/core/file/new_spec.rb26
-rw-r--r--spec/ruby/core/file/open_spec.rb42
-rw-r--r--spec/ruby/core/file/rename_spec.rb8
-rw-r--r--spec/ruby/core/file/shared/path.rb3
-rw-r--r--spec/ruby/core/file/shared/unlink.rb10
-rw-r--r--spec/ruby/core/file/world_readable_spec.rb2
-rw-r--r--spec/ruby/core/file/world_writable_spec.rb2
-rw-r--r--spec/ruby/core/io/advise_spec.rb3
-rw-r--r--spec/ruby/core/io/reopen_spec.rb4
-rw-r--r--spec/ruby/core/io/shared/binwrite.rb8
-rw-r--r--spec/ruby/core/io/shared/tty.rb3
-rw-r--r--spec/ruby/core/io/write_nonblock_spec.rb6
-rw-r--r--spec/ruby/core/kernel/caller_locations_spec.rb2
-rw-r--r--spec/ruby/core/kernel/shared/require.rb8
-rw-r--r--spec/ruby/core/string/dump_spec.rb4
-rw-r--r--spec/ruby/core/string/end_with_spec.rb21
-rw-r--r--spec/ruby/core/string/start_with_spec.rb36
-rw-r--r--spec/ruby/library/logger/device/new_spec.rb2
-rw-r--r--spec/ruby/library/logger/logger/new_spec.rb6
-rw-r--r--spec/ruby/library/rbconfig/rbconfig_spec.rb4
-rw-r--r--spec/ruby/library/rubygems/gem/bin_path_spec.rb15
-rw-r--r--spec/ruby/library/tempfile/close_spec.rb6
-rw-r--r--spec/ruby/library/tempfile/initialize_spec.rb2
-rw-r--r--spec/ruby/library/tempfile/shared/unlink.rb2
-rw-r--r--spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb2
-rw-r--r--spec/ruby/shared/file/grpowned.rb3
-rw-r--r--spec/ruby/shared/file/world_readable.rb2
-rw-r--r--spec/ruby/shared/file/world_writable.rb2
-rw-r--r--spec/ruby/shared/process/fork.rb4
35 files changed, 127 insertions, 133 deletions
diff --git a/spec/ruby/core/dir/chdir_spec.rb b/spec/ruby/core/dir/chdir_spec.rb
index e9b8274382..729ac403e3 100644
--- a/spec/ruby/core/dir/chdir_spec.rb
+++ b/spec/ruby/core/dir/chdir_spec.rb
@@ -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
diff --git a/spec/ruby/core/dir/mkdir_spec.rb b/spec/ruby/core/dir/mkdir_spec.rb
index 58767a5aa0..c6e2f164e2 100644
--- a/spec/ruby/core/dir/mkdir_spec.rb
+++ b/spec/ruby/core/dir/mkdir_spec.rb
@@ -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
diff --git a/spec/ruby/core/dir/shared/chroot.rb b/spec/ruby/core/dir/shared/chroot.rb
index 93699f93be..b14a433670 100644
--- a/spec/ruby/core/dir/shared/chroot.rb
+++ b/spec/ruby/core/dir/shared/chroot.rb
@@ -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
diff --git a/spec/ruby/core/dir/shared/exist.rb b/spec/ruby/core/dir/shared/exist.rb
index fbd2c9862d..765d1b656c 100644
--- a/spec/ruby/core/dir/shared/exist.rb
+++ b/spec/ruby/core/dir/shared/exist.rb
@@ -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
diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb
index 62675145df..b47e23b41c 100644
--- a/spec/ruby/core/dir/shared/glob.rb
+++ b/spec/ruby/core/dir/shared/glob.rb
@@ -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
diff --git a/spec/ruby/core/file/link_spec.rb b/spec/ruby/core/file/link_spec.rb
index 11d4c8d25b..cc63c76aa3 100644
--- a/spec/ruby/core/file/link_spec.rb
+++ b/spec/ruby/core/file/link_spec.rb
@@ -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
diff --git a/spec/ruby/core/file/new_spec.rb b/spec/ruby/core/file/new_spec.rb
index e99f6ba72b..004f78503a 100644
--- a/spec/ruby/core/file/new_spec.rb
+++ b/spec/ruby/core/file/new_spec.rb
@@ -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
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb
index b6af2686e4..93f1972ac6 100644
--- a/spec/ruby/core/file/open_spec.rb
+++ b/spec/ruby/core/file/open_spec.rb
@@ -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
diff --git a/spec/ruby/core/file/rename_spec.rb b/spec/ruby/core/file/rename_spec.rb
index d903e7a0d5..f2c18d4905 100644
--- a/spec/ruby/core/file/rename_spec.rb
+++ b/spec/ruby/core/file/rename_spec.rb
@@ -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
diff --git a/spec/ruby/core/file/shared/path.rb b/spec/ruby/core/file/shared/path.rb
index 9df3416c89..cfd119f799 100644
--- a/spec/ruby/core/file/shared/path.rb
+++ b/spec/ruby/core/file/shared/path.rb
@@ -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
diff --git a/spec/ruby/core/file/shared/unlink.rb b/spec/ruby/core/file/shared/unlink.rb
index d72ab4701f..e339e93271 100644
--- a/spec/ruby/core/file/shared/unlink.rb
+++ b/spec/ruby/core/file/shared/unlink.rb
@@ -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
diff --git a/spec/ruby/core/file/world_readable_spec.rb b/spec/ruby/core/file/world_readable_spec.rb
index 7e6c60b65c..11b8e67d0b 100644
--- a/spec/ruby/core/file/world_readable_spec.rb
+++ b/spec/ruby/core/file/world_readable_spec.rb
@@ -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
diff --git a/spec/ruby/core/file/world_writable_spec.rb b/spec/ruby/core/file/world_writable_spec.rb
index 00333a98ab..d378cf2eb9 100644
--- a/spec/ruby/core/file/world_writable_spec.rb
+++ b/spec/ruby/core/file/world_writable_spec.rb
@@ -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
diff --git a/spec/ruby/core/io/advise_spec.rb b/spec/ruby/core/io/advise_spec.rb
index 59469fa164..0a845487e2 100644
--- a/spec/ruby/core/io/advise_spec.rb
+++ b/spec/ruby/core/io/advise_spec.rb
@@ -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
diff --git a/spec/ruby/core/io/reopen_spec.rb b/spec/ruby/core/io/reopen_spec.rb
index 975f654b66..faef80f513 100644
--- a/spec/ruby/core/io/reopen_spec.rb
+++ b/spec/ruby/core/io/reopen_spec.rb
@@ -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
diff --git a/spec/ruby/core/io/shared/binwrite.rb b/spec/ruby/core/io/shared/binwrite.rb
index 29310e1eaf..3649bb47ff 100644
--- a/spec/ruby/core/io/shared/binwrite.rb
+++ b/spec/ruby/core/io/shared/binwrite.rb
@@ -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
diff --git a/spec/ruby/core/io/shared/tty.rb b/spec/ruby/core/io/shared/tty.rb
index 82a780a9f3..89ac08ec86 100644
--- a/spec/ruby/core/io/shared/tty.rb
+++ b/spec/ruby/core/io/shared/tty.rb
@@ -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
diff --git a/spec/ruby/core/io/write_nonblock_spec.rb b/spec/ruby/core/io/write_nonblock_spec.rb
index 18adfcfc4a..5474e5c6ce 100644
--- a/spec/ruby/core/io/write_nonblock_spec.rb
+++ b/spec/ruby/core/io/write_nonblock_spec.rb
@@ -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
diff --git a/spec/ruby/core/kernel/caller_locations_spec.rb b/spec/ruby/core/kernel/caller_locations_spec.rb
index 03c05883d1..4de6c2ffd6 100644
--- a/spec/ruby/core/kernel/caller_locations_spec.rb
+++ b/spec/ruby/core/kernel/caller_locations_spec.rb
@@ -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
diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb
index cfa1a4bbbd..52089f22fe 100644
--- a/spec/ruby/core/kernel/shared/require.rb
+++ b/spec/ruby/core/kernel/shared/require.rb
@@ -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
diff --git a/spec/ruby/core/string/dump_spec.rb b/spec/ruby/core/string/dump_spec.rb
index aa91114893..95eb9aa874 100644
--- a/spec/ruby/core/string/dump_spec.rb
+++ b/spec/ruby/core/string/dump_spec.rb
@@ -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
diff --git a/spec/ruby/core/string/end_with_spec.rb b/spec/ruby/core/string/end_with_spec.rb
index b7a04fdefe..9ced0ca3d2 100644
--- a/spec/ruby/core/string/end_with_spec.rb
+++ b/spec/ruby/core/string/end_with_spec.rb
@@ -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
diff --git a/spec/ruby/core/string/start_with_spec.rb b/spec/ruby/core/string/start_with_spec.rb
index f66ec55266..1000db180c 100644
--- a/spec/ruby/core/string/start_with_spec.rb
+++ b/spec/ruby/core/string/start_with_spec.rb
@@ -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
diff --git a/spec/ruby/library/logger/device/new_spec.rb b/spec/ruby/library/logger/device/new_spec.rb
index 2002e6f68e..26a38c2b8c 100644
--- a/spec/ruby/library/logger/device/new_spec.rb
+++ b/spec/ruby/library/logger/device/new_spec.rb
@@ -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
diff --git a/spec/ruby/library/logger/logger/new_spec.rb b/spec/ruby/library/logger/logger/new_spec.rb
index f70e1904f3..d3100ee2d1 100644
--- a/spec/ruby/library/logger/logger/new_spec.rb
+++ b/spec/ruby/library/logger/logger/new_spec.rb
@@ -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
diff --git a/spec/ruby/library/rbconfig/rbconfig_spec.rb b/spec/ruby/library/rbconfig/rbconfig_spec.rb
index 6725de8289..7c3fbf6c58 100644
--- a/spec/ruby/library/rbconfig/rbconfig_spec.rb
+++ b/spec/ruby/library/rbconfig/rbconfig_spec.rb
@@ -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
diff --git a/spec/ruby/library/rubygems/gem/bin_path_spec.rb b/spec/ruby/library/rubygems/gem/bin_path_spec.rb
index 73509e9066..bfcc3fba89 100644
--- a/spec/ruby/library/rubygems/gem/bin_path_spec.rb
+++ b/spec/ruby/library/rubygems/gem/bin_path_spec.rb
@@ -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
diff --git a/spec/ruby/library/tempfile/close_spec.rb b/spec/ruby/library/tempfile/close_spec.rb
index 6cd55beecf..db0eae3fa5 100644
--- a/spec/ruby/library/tempfile/close_spec.rb
+++ b/spec/ruby/library/tempfile/close_spec.rb
@@ -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
diff --git a/spec/ruby/library/tempfile/initialize_spec.rb b/spec/ruby/library/tempfile/initialize_spec.rb
index 3b20e8ad4b..f2e786d7d8 100644
--- a/spec/ruby/library/tempfile/initialize_spec.rb
+++ b/spec/ruby/library/tempfile/initialize_spec.rb
@@ -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
diff --git a/spec/ruby/library/tempfile/shared/unlink.rb b/spec/ruby/library/tempfile/shared/unlink.rb
index 2b575fd391..e821228d70 100644
--- a/spec/ruby/library/tempfile/shared/unlink.rb
+++ b/spec/ruby/library/tempfile/shared/unlink.rb
@@ -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
diff --git a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
index eab86818bd..8165c2d8a8 100644
--- a/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
+++ b/spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
@@ -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
diff --git a/spec/ruby/shared/file/grpowned.rb b/spec/ruby/shared/file/grpowned.rb
index 91a6483030..24e84c28e3 100644
--- a/spec/ruby/shared/file/grpowned.rb
+++ b/spec/ruby/shared/file/grpowned.rb
@@ -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
diff --git a/spec/ruby/shared/file/world_readable.rb b/spec/ruby/shared/file/world_readable.rb
index 0fd5a28397..85761e633f 100644
--- a/spec/ruby/shared/file/world_readable.rb
+++ b/spec/ruby/shared/file/world_readable.rb
@@ -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)
diff --git a/spec/ruby/shared/file/world_writable.rb b/spec/ruby/shared/file/world_writable.rb
index da8af0bc2a..61b691bcb6 100644
--- a/spec/ruby/shared/file/world_writable.rb
+++ b/spec/ruby/shared/file/world_writable.rb
@@ -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)
diff --git a/spec/ruby/shared/process/fork.rb b/spec/ruby/shared/process/fork.rb
index cb863b42d8..11e18d7b1c 100644
--- a/spec/ruby/shared/process/fork.rb
+++ b/spec/ruby/shared/process/fork.rb
@@ -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