diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-07-27 12:40:09 +0200 |
commit | 5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch) | |
tree | 05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/core/dir | |
parent | a06301b103371b0b7da8eaca26ba744961769f99 (diff) |
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/core/dir')
-rw-r--r-- | spec/ruby/core/dir/chdir_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/dir/children_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/chroot_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/dir/close_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/each_child_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/empty_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/entries_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/fileno_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/foreach_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/home_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/mkdir_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/chroot.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/closed.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/delete.rb | 10 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/glob.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/dir/shared/open.rb | 8 |
16 files changed, 31 insertions, 31 deletions
diff --git a/spec/ruby/core/dir/chdir_spec.rb b/spec/ruby/core/dir/chdir_spec.rb index a2383e6bf2..e9b8274382 100644 --- a/spec/ruby/core/dir/chdir_spec.rb +++ b/spec/ruby/core/dir/chdir_spec.rb @@ -88,8 +88,8 @@ describe "Dir.chdir" do end it "raises an Errno::ENOENT if the directory does not exist" do - lambda { Dir.chdir DirSpecs.nonexistent }.should raise_error(Errno::ENOENT) - lambda { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(Errno::ENOENT) + -> { Dir.chdir DirSpecs.nonexistent }.should raise_error(Errno::ENOENT) + -> { Dir.chdir(DirSpecs.nonexistent) { } }.should raise_error(Errno::ENOENT) end it "raises an Errno::ENOENT if the original directory no longer exists" do @@ -100,7 +100,7 @@ describe "Dir.chdir" do Dir.mkdir dir1 Dir.mkdir dir2 begin - lambda { + -> { Dir.chdir dir1 do Dir.chdir(dir2) { Dir.unlink dir1 } end diff --git a/spec/ruby/core/dir/children_spec.rb b/spec/ruby/core/dir/children_spec.rb index ef8b20b1f0..8f6e62b463 100644 --- a/spec/ruby/core/dir/children_spec.rb +++ b/spec/ruby/core/dir/children_spec.rb @@ -66,7 +66,7 @@ ruby_version_is "2.5" do end it "raises a SystemCallError if called with a nonexistent directory" do - lambda { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError) + -> { Dir.children DirSpecs.nonexistent }.should raise_error(SystemCallError) end end end diff --git a/spec/ruby/core/dir/chroot_spec.rb b/spec/ruby/core/dir/chroot_spec.rb index bce4d6f286..55392410e7 100644 --- a/spec/ruby/core/dir/chroot_spec.rb +++ b/spec/ruby/core/dir/chroot_spec.rb @@ -21,17 +21,17 @@ platform_is_not :windows do end it "raises an Errno::EPERM exception if the directory exists" do - lambda { Dir.chroot('.') }.should raise_error(Errno::EPERM) + -> { Dir.chroot('.') }.should raise_error(Errno::EPERM) end it "raises a SystemCallError if the directory doesn't exist" do - lambda { Dir.chroot('xgwhwhsjai2222jg') }.should raise_error(SystemCallError) + -> { Dir.chroot('xgwhwhsjai2222jg') }.should raise_error(SystemCallError) end it "calls #to_path on non-String argument" do p = mock('path') p.should_receive(:to_path).and_return('.') - lambda { Dir.chroot(p) }.should raise_error(Errno::EPERM) + -> { Dir.chroot(p) }.should raise_error(Errno::EPERM) end end end diff --git a/spec/ruby/core/dir/close_spec.rb b/spec/ruby/core/dir/close_spec.rb index 64d87140ae..5fad5eecfb 100644 --- a/spec/ruby/core/dir/close_spec.rb +++ b/spec/ruby/core/dir/close_spec.rb @@ -12,7 +12,7 @@ describe "Dir#close" do it "does not raise an IOError even if the Dir instance is closed" do dir = Dir.open DirSpecs.mock_dir dir.close - lambda { + -> { dir.close }.should_not raise_error(IOError) end diff --git a/spec/ruby/core/dir/each_child_spec.rb b/spec/ruby/core/dir/each_child_spec.rb index c04d212bfa..dcc9a456c7 100644 --- a/spec/ruby/core/dir/each_child_spec.rb +++ b/spec/ruby/core/dir/each_child_spec.rb @@ -32,7 +32,7 @@ ruby_version_is "2.5" do end it "raises a SystemCallError if passed a nonexistent directory" do - lambda { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) + -> { Dir.each_child(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) end describe "when no block is given" do diff --git a/spec/ruby/core/dir/empty_spec.rb b/spec/ruby/core/dir/empty_spec.rb index 626b228439..8cc8757798 100644 --- a/spec/ruby/core/dir/empty_spec.rb +++ b/spec/ruby/core/dir/empty_spec.rb @@ -26,6 +26,6 @@ describe "Dir.empty?" do end it "raises ENOENT for nonexistent directories" do - lambda { Dir.empty? tmp("nonexistent") }.should raise_error(Errno::ENOENT) + -> { Dir.empty? tmp("nonexistent") }.should raise_error(Errno::ENOENT) end end diff --git a/spec/ruby/core/dir/entries_spec.rb b/spec/ruby/core/dir/entries_spec.rb index ed45287e82..33568b6fc4 100644 --- a/spec/ruby/core/dir/entries_spec.rb +++ b/spec/ruby/core/dir/entries_spec.rb @@ -65,6 +65,6 @@ describe "Dir.entries" do end it "raises a SystemCallError if called with a nonexistent directory" do - lambda { Dir.entries DirSpecs.nonexistent }.should raise_error(SystemCallError) + -> { Dir.entries DirSpecs.nonexistent }.should raise_error(SystemCallError) end end diff --git a/spec/ruby/core/dir/fileno_spec.rb b/spec/ruby/core/dir/fileno_spec.rb index 5a893d2da9..504e36d44b 100644 --- a/spec/ruby/core/dir/fileno_spec.rb +++ b/spec/ruby/core/dir/fileno_spec.rb @@ -31,7 +31,7 @@ describe "Dir#fileno" do end else it "raises an error when not implemented on the platform" do - lambda { @dir.fileno }.should raise_error(NotImplementedError) + -> { @dir.fileno }.should raise_error(NotImplementedError) end end end diff --git a/spec/ruby/core/dir/foreach_spec.rb b/spec/ruby/core/dir/foreach_spec.rb index fed0aa8065..1560b85f8a 100644 --- a/spec/ruby/core/dir/foreach_spec.rb +++ b/spec/ruby/core/dir/foreach_spec.rb @@ -31,7 +31,7 @@ describe "Dir.foreach" do end it "raises a SystemCallError if passed a nonexistent directory" do - lambda { Dir.foreach(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) + -> { Dir.foreach(DirSpecs.nonexistent) {} }.should raise_error(SystemCallError) end it "returns an Enumerator if no block given" do diff --git a/spec/ruby/core/dir/home_spec.rb b/spec/ruby/core/dir/home_spec.rb index db46b80c54..cdfc9346dc 100644 --- a/spec/ruby/core/dir/home_spec.rb +++ b/spec/ruby/core/dir/home_spec.rb @@ -40,6 +40,6 @@ describe "Dir.home" do end it "raises an ArgumentError if the named user doesn't exist" do - lambda { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError) + -> { Dir.home('geuw2n288dh2k') }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/core/dir/mkdir_spec.rb b/spec/ruby/core/dir/mkdir_spec.rb index d0bf32c143..58767a5aa0 100644 --- a/spec/ruby/core/dir/mkdir_spec.rb +++ b/spec/ruby/core/dir/mkdir_spec.rb @@ -51,15 +51,15 @@ describe "Dir.mkdir" do end it "raises a SystemCallError if any of the directories in the path before the last does not exist" do - lambda { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError) + -> { Dir.mkdir "#{DirSpecs.nonexistent}/subdir" }.should raise_error(SystemCallError) end it "raises Errno::EEXIST if the specified directory already exists" do - lambda { Dir.mkdir("#{DirSpecs.mock_dir}/dir") }.should raise_error(Errno::EEXIST) + -> { Dir.mkdir("#{DirSpecs.mock_dir}/dir") }.should raise_error(Errno::EEXIST) end it "raises Errno::EEXIST if the argument points to the existing file" do - lambda { Dir.mkdir("#{DirSpecs.mock_dir}/file_one.ext") }.should raise_error(Errno::EEXIST) + -> { Dir.mkdir("#{DirSpecs.mock_dir}/file_one.ext") }.should raise_error(Errno::EEXIST) end end @@ -80,7 +80,7 @@ platform_is_not :windows do it "raises a SystemCallError when lacking adequate permissions in the parent dir" do Dir.mkdir @dir, 0000 - lambda { Dir.mkdir "#{@dir}/subdir" }.should raise_error(SystemCallError) + -> { Dir.mkdir "#{@dir}/subdir" }.should raise_error(SystemCallError) end end end diff --git a/spec/ruby/core/dir/shared/chroot.rb b/spec/ruby/core/dir/shared/chroot.rb index 2ed033dfed..93699f93be 100644 --- a/spec/ruby/core/dir/shared/chroot.rb +++ b/spec/ruby/core/dir/shared/chroot.rb @@ -15,7 +15,7 @@ describe :dir_chroot_as_root, shared: true do end it "can be used to change the process' root directory" do - lambda { Dir.send(@method, File.dirname(__FILE__)) }.should_not raise_error + -> { Dir.send(@method, File.dirname(__FILE__)) }.should_not raise_error File.exist?("/#{File.basename(__FILE__)}").should be_true end @@ -24,7 +24,7 @@ describe :dir_chroot_as_root, shared: true do end it "raises an Errno::ENOENT exception if the directory doesn't exist" do - lambda { Dir.send(@method, 'xgwhwhsjai2222jg') }.should raise_error(Errno::ENOENT) + -> { Dir.send(@method, 'xgwhwhsjai2222jg') }.should raise_error(Errno::ENOENT) end it "can be escaped from with ../" do diff --git a/spec/ruby/core/dir/shared/closed.rb b/spec/ruby/core/dir/shared/closed.rb index a1bce06a08..17d8332c2a 100644 --- a/spec/ruby/core/dir/shared/closed.rb +++ b/spec/ruby/core/dir/shared/closed.rb @@ -1,6 +1,6 @@ describe :dir_closed, shared: true do it "raises an IOError when called on a closed Dir instance" do - lambda { + -> { dir = Dir.open DirSpecs.mock_dir dir.close dir.send(@method) {} diff --git a/spec/ruby/core/dir/shared/delete.rb b/spec/ruby/core/dir/shared/delete.rb index 649708cd76..49e88360e8 100644 --- a/spec/ruby/core/dir/shared/delete.rb +++ b/spec/ruby/core/dir/shared/delete.rb @@ -19,7 +19,7 @@ describe :dir_delete, shared: true do platform_is_not :solaris do it "raises an Errno::ENOTEMPTY when trying to remove a nonempty directory" do - lambda do + -> do Dir.send @method, DirSpecs.mock_rmdir("nonempty") end.should raise_error(Errno::ENOTEMPTY) end @@ -27,14 +27,14 @@ describe :dir_delete, shared: true do platform_is :solaris do it "raises an Errno::EEXIST when trying to remove a nonempty directory" do - lambda do + -> do Dir.send @method, DirSpecs.mock_rmdir("nonempty") end.should raise_error(Errno::EEXIST) end end it "raises an Errno::ENOENT when trying to remove a non-existing directory" do - lambda do + -> do Dir.send @method, DirSpecs.nonexistent end.should raise_error(Errno::ENOENT) end @@ -42,7 +42,7 @@ describe :dir_delete, shared: true do it "raises an Errno::ENOTDIR when trying to remove a non-directory" do file = DirSpecs.mock_rmdir("nonempty/regular") touch(file) - lambda do + -> do Dir.send @method, file end.should raise_error(Errno::ENOTDIR) end @@ -54,7 +54,7 @@ describe :dir_delete, shared: true do parent = DirSpecs.mock_rmdir("noperm") child = DirSpecs.mock_rmdir("noperm", "child") File.chmod(0000, parent) - lambda do + -> do Dir.send @method, child end.should raise_error(Errno::EACCES) end diff --git a/spec/ruby/core/dir/shared/glob.rb b/spec/ruby/core/dir/shared/glob.rb index af587dd33b..e4ffb51286 100644 --- a/spec/ruby/core/dir/shared/glob.rb +++ b/spec/ruby/core/dir/shared/glob.rb @@ -13,7 +13,7 @@ describe :dir_glob, shared: true do it "raises an Encoding::CompatibilityError if the argument encoding is not compatible with US-ASCII" do pattern = "file*".force_encoding Encoding::UTF_16BE - lambda { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError) + -> { Dir.send(@method, pattern) }.should raise_error(Encoding::CompatibilityError) end it "calls #to_path to convert a pattern" do diff --git a/spec/ruby/core/dir/shared/open.rb b/spec/ruby/core/dir/shared/open.rb index 63e9036053..fb2af71e05 100644 --- a/spec/ruby/core/dir/shared/open.rb +++ b/spec/ruby/core/dir/shared/open.rb @@ -6,7 +6,7 @@ describe :dir_open, shared: true do end it "raises a SystemCallError if the directory does not exist" do - lambda do + -> do Dir.send @method, DirSpecs.nonexistent end.should raise_error(SystemCallError) end @@ -21,20 +21,20 @@ describe :dir_open, shared: true do it "closes the Dir instance when the block exits if given a block" do closed_dir = Dir.send(@method, DirSpecs.mock_dir) { |dir| dir } - lambda { closed_dir.read }.should raise_error(IOError) + -> { closed_dir.read }.should raise_error(IOError) end it "closes the Dir instance when the block exits the block even due to an exception" do closed_dir = nil - lambda do + -> do Dir.send(@method, DirSpecs.mock_dir) do |dir| closed_dir = dir raise "dir specs" end end.should raise_error(RuntimeError, "dir specs") - lambda { closed_dir.read }.should raise_error(IOError) + -> { closed_dir.read }.should raise_error(IOError) end it "calls #to_path on non-String arguments" do |