ruby-changes:46732
From: nobu <ko1@a...>
Date: Mon, 22 May 2017 23:26:02 +0900 (JST)
Subject: [ruby-changes:46732] nobu:r58847 (trunk): source directory may not be writable
nobu 2017-05-22 23:25:56 +0900 (Mon, 22 May 2017) New Revision: 58847 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58847 Log: source directory may not be writable Modified files: trunk/spec/rubyspec/core/dir/shared/delete.rb trunk/spec/rubyspec/core/kernel/test_spec.rb Index: spec/rubyspec/core/dir/shared/delete.rb =================================================================== --- spec/rubyspec/core/dir/shared/delete.rb (revision 58846) +++ spec/rubyspec/core/dir/shared/delete.rb (revision 58847) @@ -40,8 +40,10 @@ describe :dir_delete, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/dir/shared/delete.rb#L40 end it "raises an Errno::ENOTDIR when trying to remove a non-directory" do + file = DirSpecs.mock_rmdir("nonempty/regular") + open(file, "w") {} lambda do - Dir.send @method, __FILE__ + Dir.send @method, file end.should raise_error(Errno::ENOTDIR) end Index: spec/rubyspec/core/kernel/test_spec.rb =================================================================== --- spec/rubyspec/core/kernel/test_spec.rb (revision 58846) +++ spec/rubyspec/core/kernel/test_spec.rb (revision 58847) @@ -43,12 +43,23 @@ describe "Kernel#test" do https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/kernel/test_spec.rb#L43 Kernel.test(?R, @file).should be_true end - it "returns true when passed ?w if the argument is readable by the effective uid" do - Kernel.test(?w, @file).should be_true - end + context "writable test" do + before do + @tmp_file = tmp("file.kernel.test") + open(@tmp_file, "w") {} + end + + after do + rm_r @tmp_file + end + + it "returns true when passed ?w if the argument is readable by the effective uid" do + Kernel.test(?w, @tmp_file).should be_true + end - it "returns true when passed ?W if the argument is readable by the real uid" do - Kernel.test(?W, @file).should be_true + it "returns true when passed ?W if the argument is readable by the real uid" do + Kernel.test(?W, @tmp_file).should be_true + end end context "time commands" do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/