diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 14:25:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-22 14:25:56 +0000 |
commit | 35695788d163372cddac8dfdb54afd101cba90e7 (patch) | |
tree | cbfd209a95bdfa5b0fe188e8ffdbe6dfc442ae49 /spec | |
parent | cbedbaf9d9c7452afac2dfc0f06e1f72e235adea (diff) | |
download | ruby-35695788d163372cddac8dfdb54afd101cba90e7.tar.gz |
source directory may not be writable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r-- | spec/rubyspec/core/dir/shared/delete.rb | 4 | ||||
-rw-r--r-- | spec/rubyspec/core/kernel/test_spec.rb | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/spec/rubyspec/core/dir/shared/delete.rb b/spec/rubyspec/core/dir/shared/delete.rb index 86af65592b..72d025bc63 100644 --- a/spec/rubyspec/core/dir/shared/delete.rb +++ b/spec/rubyspec/core/dir/shared/delete.rb @@ -40,8 +40,10 @@ describe :dir_delete, shared: true do 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 diff --git a/spec/rubyspec/core/kernel/test_spec.rb b/spec/rubyspec/core/kernel/test_spec.rb index 21d338ed07..1a6e346616 100644 --- a/spec/rubyspec/core/kernel/test_spec.rb +++ b/spec/rubyspec/core/kernel/test_spec.rb @@ -43,12 +43,23 @@ describe "Kernel#test" do 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 |