summaryrefslogtreecommitdiff
path: root/spec/rubyspec/shared/file
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/shared/file')
-rw-r--r--spec/rubyspec/shared/file/blockdev.rb9
-rw-r--r--spec/rubyspec/shared/file/chardev.rb9
-rw-r--r--spec/rubyspec/shared/file/directory.rb66
-rw-r--r--spec/rubyspec/shared/file/executable.rb48
-rw-r--r--spec/rubyspec/shared/file/executable_real.rb46
-rw-r--r--spec/rubyspec/shared/file/exist.rb24
-rw-r--r--spec/rubyspec/shared/file/file.rb45
-rw-r--r--spec/rubyspec/shared/file/grpowned.rb40
-rw-r--r--spec/rubyspec/shared/file/identical.rb47
-rw-r--r--spec/rubyspec/shared/file/owned.rb3
-rw-r--r--spec/rubyspec/shared/file/pipe.rb3
-rw-r--r--spec/rubyspec/shared/file/readable.rb30
-rw-r--r--spec/rubyspec/shared/file/readable_real.rb23
-rw-r--r--spec/rubyspec/shared/file/setgid.rb2
-rw-r--r--spec/rubyspec/shared/file/setuid.rb2
-rw-r--r--spec/rubyspec/shared/file/size.rb124
-rw-r--r--spec/rubyspec/shared/file/socket.rb3
-rw-r--r--spec/rubyspec/shared/file/sticky.rb29
-rw-r--r--spec/rubyspec/shared/file/symlink.rb46
-rw-r--r--spec/rubyspec/shared/file/world_readable.rb49
-rw-r--r--spec/rubyspec/shared/file/world_writable.rb49
-rw-r--r--spec/rubyspec/shared/file/writable.rb26
-rw-r--r--spec/rubyspec/shared/file/writable_real.rb33
-rw-r--r--spec/rubyspec/shared/file/zero.rb76
24 files changed, 0 insertions, 832 deletions
diff --git a/spec/rubyspec/shared/file/blockdev.rb b/spec/rubyspec/shared/file/blockdev.rb
deleted file mode 100644
index b0b3ea040a..0000000000
--- a/spec/rubyspec/shared/file/blockdev.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-describe :file_blockdev, shared: true do
- it "returns true/false depending if the named file is a block device" do
- @object.send(@method, tmp("")).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(tmp(""))).should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/chardev.rb b/spec/rubyspec/shared/file/chardev.rb
deleted file mode 100644
index 8a7a89fd05..0000000000
--- a/spec/rubyspec/shared/file/chardev.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-describe :file_chardev, shared: true do
- it "returns true/false depending if the named file is a char device" do
- @object.send(@method, tmp("")).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(tmp(""))).should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/directory.rb b/spec/rubyspec/shared/file/directory.rb
deleted file mode 100644
index 67e939bf16..0000000000
--- a/spec/rubyspec/shared/file/directory.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-describe :file_directory, shared: true do
- before :each do
- @dir = tmp("file_directory")
- @file = tmp("file_directory.txt")
-
- mkdir_p @dir
- touch @file
- end
-
- after :each do
- rm_r @dir, @file
- end
-
- it "returns true if the argument is a directory" do
- @object.send(@method, @dir).should be_true
- end
-
- it "returns false if the argument is not a directory" do
- @object.send(@method, @file).should be_false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@dir)).should be_true
- end
-
- it "raises a TypeError when passed an Integer" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, bignum_value) }.should raise_error(TypeError)
- end
-
- it "raises a TypeError when passed nil" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- end
-end
-
-describe :file_directory_io, shared: true do
- before :each do
- @dir = tmp("file_directory_io")
- @file = tmp("file_directory_io.txt")
-
- mkdir_p @dir
- touch @file
- end
-
- after :each do
- rm_r @dir, @file
- end
-
- it "returns false if the argument is an IO that's not a directory" do
- @object.send(@method, STDIN).should be_false
- end
-
- platform_is_not :windows do
- it "returns true if the argument is an IO that is a directory" do
- File.open(@dir, "r") do |f|
- @object.send(@method, f).should be_true
- end
- end
- end
-
- it "calls #to_io to convert a non-IO object" do
- io = mock('FileDirectoryIO')
- io.should_receive(:to_io).and_return(STDIN)
- @object.send(@method, io).should be_false
- end
-end
diff --git a/spec/rubyspec/shared/file/executable.rb b/spec/rubyspec/shared/file/executable.rb
deleted file mode 100644
index 5b21fb0d97..0000000000
--- a/spec/rubyspec/shared/file/executable.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-describe :file_executable, shared: true do
- before :each do
- @file1 = tmp('temp1.txt')
- @file2 = tmp('temp2.txt')
-
- touch @file1
- touch @file2
-
- File.chmod(0755, @file1)
- end
-
- after :each do
- rm_r @file1, @file2
- end
-
- platform_is_not :windows do
- it "returns true if named file is executable by the effective user id of the process, otherwise false" do
- @object.send(@method, '/etc/passwd').should == false
- @object.send(@method, @file1).should == true
- @object.send(@method, @file2).should == false
- end
-
- it "returns true if the argument is an executable file" do
- @object.send(@method, @file1).should == true
- @object.send(@method, @file2).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file1)).should == true
- end
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
- end
-end
-
-describe :file_executable_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/executable_real.rb b/spec/rubyspec/shared/file/executable_real.rb
deleted file mode 100644
index 2b1bf8f585..0000000000
--- a/spec/rubyspec/shared/file/executable_real.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-describe :file_executable_real, shared: true do
- before :each do
- @file1 = tmp('temp1.txt.exe')
- @file2 = tmp('temp2.txt')
-
- touch @file1
- touch @file2
-
- File.chmod(0755, @file1)
- end
-
- after :each do
- rm_r @file1, @file2
- end
-
- platform_is_not :windows do
- it "returns true if the file its an executable" do
- @object.send(@method, @file1).should == true
- @object.send(@method, @file2).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file1)).should == true
- end
- end
-
- it "returns true if named file is readable by the real user id of the process, otherwise false" do
- @object.send(@method, @file1).should == true
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
- end
-end
-
-describe :file_executable_real_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/exist.rb b/spec/rubyspec/shared/file/exist.rb
deleted file mode 100644
index 1557f01a82..0000000000
--- a/spec/rubyspec/shared/file/exist.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-describe :file_exist, shared: true do
- it "returns true if the file exist" do
- @object.send(@method, __FILE__).should == true
- @object.send(@method, 'a_fake_file').should == false
- end
-
- it "returns true if the file exist using the alias exists?" do
- @object.send(@method, __FILE__).should == true
- @object.send(@method, 'a_fake_file').should == false
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, __FILE__, __FILE__) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(__FILE__)).should == true
- end
-end
diff --git a/spec/rubyspec/shared/file/file.rb b/spec/rubyspec/shared/file/file.rb
deleted file mode 100644
index 095bd63fff..0000000000
--- a/spec/rubyspec/shared/file/file.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-describe :file_file, shared: true do
- before :each do
- platform_is :windows do
- @null = "NUL"
- @dir = "C:\\"
- end
-
- platform_is_not :windows do
- @null = "/dev/null"
- @dir = "/bin"
- end
-
- @file = tmp("test.txt")
- touch @file
- end
-
- after :each do
- rm_r @file
- end
-
- it "returns true if the named file exists and is a regular file." do
- @object.send(@method, @file).should == true
- @object.send(@method, @dir).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file)).should == true
- end
-
- platform_is_not :windows do
- it "returns true if the null device exists and is a regular file." do
- @object.send(@method, @null).should == false # May fail on MS Windows
- end
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { @object.send(@method) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, @null, @file) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- end
-end
diff --git a/spec/rubyspec/shared/file/grpowned.rb b/spec/rubyspec/shared/file/grpowned.rb
deleted file mode 100644
index 91a6483030..0000000000
--- a/spec/rubyspec/shared/file/grpowned.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-describe :file_grpowned, shared: true do
- before :each do
- @file = tmp('i_exist')
- touch(@file) { |f| f.puts "file_content" }
- File.chown(nil, Process.gid, @file) rescue nil
- end
-
- after :each do
- rm_r @file
- end
-
- platform_is_not :windows do
- it "returns true if the file exist" do
- @object.send(@method, @file).should be_true
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file)).should be_true
- end
-
- it 'takes non primary groups into account' do
- group = (Process.groups - [Process.egid]).first
-
- if group
- File.chown(nil, group, @file)
-
- @object.send(@method, @file).should == true
- else
- # No supplementary groups
- 1.should == 1
- end
- end
- end
-
- platform_is :windows do
- it "returns false if the file exist" do
- @object.send(@method, @file).should be_false
- end
- end
-end
diff --git a/spec/rubyspec/shared/file/identical.rb b/spec/rubyspec/shared/file/identical.rb
deleted file mode 100644
index e89cd309ea..0000000000
--- a/spec/rubyspec/shared/file/identical.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-describe :file_identical, shared: true do
- before :each do
- @file1 = tmp('file_identical.txt')
- @file2 = tmp('file_identical2.txt')
- @link = tmp('file_identical.lnk')
- @non_exist = 'non_exist'
-
- touch(@file1) { |f| f.puts "file1" }
- touch(@file2) { |f| f.puts "file2" }
-
- rm_r @link
- File.link(@file1, @link)
- end
-
- after :each do
- rm_r @link, @file1, @file2
- end
-
- it "returns true for a file and its link" do
- @object.send(@method, @file1, @link).should == true
- end
-
- it "returns false if any of the files doesn't exist" do
- @object.send(@method, @file1, @non_exist).should be_false
- @object.send(@method, @non_exist, @file1).should be_false
- @object.send(@method, @non_exist, @non_exist).should be_false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file1), mock_to_path(@link)).should == true
- end
-
- it "raises an ArgumentError if not passed two arguments" do
- lambda { @object.send(@method, @file1, @file2, @link) }.should raise_error(ArgumentError)
- lambda { @object.send(@method, @file1) }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed String types" do
- lambda { @object.send(@method, 1,1) }.should raise_error(TypeError)
- end
-
- it "returns true if both named files are identical" do
- @object.send(@method, @file1, @file1).should be_true
- @object.send(@method, @link, @link).should be_true
- @object.send(@method, @file1, @file2).should be_false
- end
-end
diff --git a/spec/rubyspec/shared/file/owned.rb b/spec/rubyspec/shared/file/owned.rb
deleted file mode 100644
index 4a08a4ed89..0000000000
--- a/spec/rubyspec/shared/file/owned.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe :file_owned, shared: true do
- it "accepts an object that has a #to_path method"
-end
diff --git a/spec/rubyspec/shared/file/pipe.rb b/spec/rubyspec/shared/file/pipe.rb
deleted file mode 100644
index 7e150b9167..0000000000
--- a/spec/rubyspec/shared/file/pipe.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe :file_pipe, shared: true do
- it "accepts an object that has a #to_path method"
-end
diff --git a/spec/rubyspec/shared/file/readable.rb b/spec/rubyspec/shared/file/readable.rb
deleted file mode 100644
index 74f58caaff..0000000000
--- a/spec/rubyspec/shared/file/readable.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-describe :file_readable, shared: true do
- before :each do
- @file = tmp('i_exist')
- platform_is :windows do
- @file2 = File.join(ENV["WINDIR"], "system32/drivers/etc/services").tr(File::SEPARATOR, File::ALT_SEPARATOR)
- end
- platform_is_not :windows do
- @file2 = "/etc/passwd"
- end
- end
-
- after :each do
- rm_r @file
- end
-
- it "returns true if named file is readable by the effective user id of the process, otherwise false" do
- @object.send(@method, @file2).should == true
- File.open(@file,'w') { @object.send(@method, @file).should == true }
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@file2)).should == true
- end
-end
-
-describe :file_readable_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/readable_real.rb b/spec/rubyspec/shared/file/readable_real.rb
deleted file mode 100644
index b6e53ac76d..0000000000
--- a/spec/rubyspec/shared/file/readable_real.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-describe :file_readable_real, shared: true do
- before :each do
- @file = tmp('i_exist')
- end
-
- after :each do
- rm_r @file
- end
-
- it "returns true if named file is readable by the real user id of the process, otherwise false" do
- File.open(@file,'w') { @object.send(@method, @file).should == true }
- end
-
- it "accepts an object that has a #to_path method" do
- File.open(@file,'w') { @object.send(@method, mock_to_path(@file)).should == true }
- end
-end
-
-describe :file_readable_real_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/setgid.rb b/spec/rubyspec/shared/file/setgid.rb
deleted file mode 100644
index 9893795832..0000000000
--- a/spec/rubyspec/shared/file/setgid.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-describe :file_setgid, shared: true do
-end
diff --git a/spec/rubyspec/shared/file/setuid.rb b/spec/rubyspec/shared/file/setuid.rb
deleted file mode 100644
index 6401674a94..0000000000
--- a/spec/rubyspec/shared/file/setuid.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-describe :file_setuid, shared: true do
-end
diff --git a/spec/rubyspec/shared/file/size.rb b/spec/rubyspec/shared/file/size.rb
deleted file mode 100644
index bb95190fc0..0000000000
--- a/spec/rubyspec/shared/file/size.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-describe :file_size, shared: true do
- before :each do
- @exists = tmp('i_exist')
- touch(@exists) { |f| f.write 'rubinius' }
- end
-
- after :each do
- rm_r @exists
- end
-
- it "returns the size of the file if it exists and is not empty" do
- @object.send(@method, @exists).should == 8
- end
-
- it "accepts a String-like (to_str) parameter" do
- obj = mock("file")
- obj.should_receive(:to_str).and_return(@exists)
-
- @object.send(@method, obj).should == 8
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@exists)).should == 8
- end
-end
-
-describe :file_size_to_io, shared: true do
- before :each do
- @exists = tmp('i_exist')
- touch(@exists) { |f| f.write 'rubinius' }
- @file = File.open(@exists, 'r')
- end
-
- after :each do
- @file.close unless @file.closed?
- rm_r @exists
- end
-
- it "calls #to_io to convert the argument to an IO" do
- obj = mock("io like")
- obj.should_receive(:to_io).and_return(@file)
-
- @object.send(@method, obj).should == 8
- end
-end
-
-describe :file_size_raise_when_missing, shared: true do
- before :each do
- # TODO: missing_file
- @missing = tmp("i_dont_exist")
- rm_r @missing
- end
-
- after :each do
- rm_r @missing
- end
-
- it "raises an error if file_name doesn't exist" do
- lambda {@object.send(@method, @missing)}.should raise_error(Errno::ENOENT)
- end
-end
-
-describe :file_size_nil_when_missing, shared: true do
- before :each do
- # TODO: missing_file
- @missing = tmp("i_dont_exist")
- rm_r @missing
- end
-
- after :each do
- rm_r @missing
- end
-
- it "returns nil if file_name doesn't exist or has 0 size" do
- @object.send(@method, @missing).should == nil
- end
-end
-
-describe :file_size_0_when_empty, shared: true do
- before :each do
- @empty = tmp("i_am_empty")
- touch @empty
- end
-
- after :each do
- rm_r @empty
- end
-
- it "returns 0 if the file is empty" do
- @object.send(@method, @empty).should == 0
- end
-end
-
-describe :file_size_nil_when_empty, shared: true do
- before :each do
- @empty = tmp("i_am_empt")
- touch @empty
- end
-
- after :each do
- rm_r @empty
- end
-
- it "returns nil if file_name is empty" do
- @object.send(@method, @empty).should == nil
- end
-end
-
-describe :file_size_with_file_argument, shared: true do
- before :each do
- @exists = tmp('i_exist')
- touch(@exists) { |f| f.write 'rubinius' }
- end
-
- after :each do
- rm_r @exists
- end
-
- it "accepts a File argument" do
- File.open(@exists) do |f|
- @object.send(@method, f).should == 8
- end
- end
-end
diff --git a/spec/rubyspec/shared/file/socket.rb b/spec/rubyspec/shared/file/socket.rb
deleted file mode 100644
index 55a1cfd284..0000000000
--- a/spec/rubyspec/shared/file/socket.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe :file_socket, shared: true do
- it "accepts an object that has a #to_path method"
-end
diff --git a/spec/rubyspec/shared/file/sticky.rb b/spec/rubyspec/shared/file/sticky.rb
deleted file mode 100644
index 38bb6ed26b..0000000000
--- a/spec/rubyspec/shared/file/sticky.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-describe :file_sticky, shared: true do
- before :each do
- @dir = tmp('sticky_dir')
- Dir.rmdir(@dir) if File.exist?(@dir)
- end
-
- after :each do
- Dir.rmdir(@dir) if File.exist?(@dir)
- end
-
- platform_is_not :windows, :darwin, :freebsd, :netbsd, :openbsd, :solaris, :aix do
- it "returns true if the named file has the sticky bit, otherwise false" do
- Dir.mkdir @dir, 01755
-
- @object.send(@method, @dir).should == true
- @object.send(@method, '/').should == false
- end
- end
-
- it "accepts an object that has a #to_path method"
-end
-
-describe :file_sticky_missing, shared: true do
- platform_is_not :windows do
- it "returns false if the file dies not exist" do
- @object.send(@method, 'fake_file').should == false
- end
- end
-end
diff --git a/spec/rubyspec/shared/file/symlink.rb b/spec/rubyspec/shared/file/symlink.rb
deleted file mode 100644
index d1c1dc94df..0000000000
--- a/spec/rubyspec/shared/file/symlink.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-describe :file_symlink, shared: true do
- before :each do
- @file = tmp("test.txt")
- @link = tmp("test.lnk")
-
- rm_r @link
- touch @file
- end
-
- after :each do
- rm_r @link, @file
- end
-
- platform_is_not :windows do
- it "returns true if the file is a link" do
- File.symlink(@file, @link)
- @object.send(@method, @link).should == true
- end
-
- it "accepts an object that has a #to_path method" do
- File.symlink(@file, @link)
- @object.send(@method, mock_to_path(@link)).should == true
- end
- end
-end
-
-describe :file_symlink_nonexistent, shared: true do
- before :each do
- @file = tmp("test.txt")
- @link = tmp("test.lnk")
-
- rm_r @link
- touch @file
- end
-
- after :each do
- rm_r @link
- rm_r @file
- end
-
- platform_is_not :windows do
- it "returns false if the file does not exist" do
- @object.send(@method, "non_existent_link").should == false
- end
- end
-end
diff --git a/spec/rubyspec/shared/file/world_readable.rb b/spec/rubyspec/shared/file/world_readable.rb
deleted file mode 100644
index 0fddf98b73..0000000000
--- a/spec/rubyspec/shared/file/world_readable.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-
-describe :file_world_readable, shared: true do
-
- before :each do
- @file = tmp('world-readable')
- touch @file
- end
-
- after :each do
- rm_r @file
- end
-
- platform_is_not :windows do
- it "returns nil if the file is chmod 600" do
- File.chmod(0600, @file)
- @object.world_readable?(@file).should be_nil
- end
-
- it "returns nil if the file is chmod 000" do
- File.chmod(0000, @file)
- @object.world_readable?(@file).should be_nil
- end
-
- it "returns nil if the file is chmod 700" do
- File.chmod(0700, @file)
- @object.world_readable?(@file).should be_nil
- end
- end
-
- # We don't specify what the Fixnum is because it's system dependent
- it "returns a Fixnum if the file is chmod 644" do
- File.chmod(0644, @file)
- @object.world_readable?(@file).should be_an_instance_of(Fixnum)
- end
-
- 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
- File.chmod(0644, dir)
- @object.world_readable?(dir).should be_an_instance_of(Fixnum)
- Dir.rmdir(dir)
- end
-
- it "coerces the argument with #to_path" do
- @object.world_readable?(mock_to_path(@file))
- end
-end
diff --git a/spec/rubyspec/shared/file/world_writable.rb b/spec/rubyspec/shared/file/world_writable.rb
deleted file mode 100644
index 43ac23a997..0000000000
--- a/spec/rubyspec/shared/file/world_writable.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-
-describe :file_world_writable, shared: true do
-
- before :each do
- @file = tmp('world-writable')
- touch @file
- end
-
- after :each do
- rm_r @file
- end
-
- platform_is_not :windows do
- it "returns nil if the file is chmod 600" do
- File.chmod(0600, @file)
- @object.world_writable?(@file).should be_nil
- end
-
- it "returns nil if the file is chmod 000" do
- File.chmod(0000, @file)
- @object.world_writable?(@file).should be_nil
- end
-
- it "returns nil if the file is chmod 700" do
- File.chmod(0700, @file)
- @object.world_writable?(@file).should be_nil
- end
-
- # We don't specify what the Fixnum is because it's system dependent
- it "returns a Fixnum if the file is chmod 777" do
- File.chmod(0777, @file)
- @object.world_writable?(@file).should be_an_instance_of(Fixnum)
- end
-
- 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
- File.chmod(0777, dir)
- @object.world_writable?(dir).should be_an_instance_of(Fixnum)
- Dir.rmdir(dir)
- end
- end
-
- it "coerces the argument with #to_path" do
- @object.world_writable?(mock_to_path(@file))
- end
-end
diff --git a/spec/rubyspec/shared/file/writable.rb b/spec/rubyspec/shared/file/writable.rb
deleted file mode 100644
index e8296928f3..0000000000
--- a/spec/rubyspec/shared/file/writable.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-describe :file_writable, shared: true do
- before :each do
- @file = tmp('i_exist')
- end
-
- after :each do
- rm_r @file
- end
-
- it "returns true if named file is writable by the effective user id of the process, otherwise false" do
- platform_is_not :windows do
- @object.send(@method, "/etc/passwd").should == false
- end
- File.open(@file,'w') { @object.send(@method, @file).should == true }
- end
-
- it "accepts an object that has a #to_path method" do
- File.open(@file,'w') { @object.send(@method, mock_to_path(@file)).should == true }
- end
-end
-
-describe :file_writable_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/writable_real.rb b/spec/rubyspec/shared/file/writable_real.rb
deleted file mode 100644
index 3730befb7a..0000000000
--- a/spec/rubyspec/shared/file/writable_real.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-describe :file_writable_real, shared: true do
- before :each do
- @file = tmp('i_exist')
- end
-
- after :each do
- rm_r @file
- end
-
- it "returns true if named file is writable by the real user id of the process, otherwise false" do
- File.open(@file,'w') { @object.send(@method, @file).should == true }
- end
-
- it "accepts an object that has a #to_path method" do
- File.open(@file,'w') { @object.send(@method, mock_to_path(@file)).should == true }
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { File.writable_real? }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, 1) }.should raise_error(TypeError)
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
- end
-end
-
-describe :file_writable_real_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end
diff --git a/spec/rubyspec/shared/file/zero.rb b/spec/rubyspec/shared/file/zero.rb
deleted file mode 100644
index bb5eea57ad..0000000000
--- a/spec/rubyspec/shared/file/zero.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-describe :file_zero, shared: true do
- before :each do
- @zero_file = tmp("test.txt")
- @nonzero_file = tmp("test2.txt")
- @dir = tmp("dir")
-
- Dir.mkdir @dir
- touch @zero_file
- touch(@nonzero_file) { |f| f.puts "hello" }
- end
-
- after :each do
- rm_r @zero_file, @nonzero_file
- rm_r @dir
- end
-
- it "returns true if the file is empty" do
- @object.send(@method, @zero_file).should == true
- end
-
- it "returns false if the file is not empty" do
- @object.send(@method, @nonzero_file).should == false
- end
-
- it "accepts an object that has a #to_path method" do
- @object.send(@method, mock_to_path(@zero_file)).should == true
- end
-
- platform_is :windows do
- it "returns true for NUL" do
- @object.send(@method, 'NUL').should == true
- @object.send(@method, 'nul').should == true
- end
- end
-
- platform_is_not :windows do
- it "returns true for /dev/null" do
- @object.send(@method, File.realpath('/dev/null')).should == true
- end
- end
-
- it "raises an ArgumentError if not passed one argument" do
- lambda { File.zero? }.should raise_error(ArgumentError)
- end
-
- it "raises a TypeError if not passed a String type" do
- lambda { @object.send(@method, nil) }.should raise_error(TypeError)
- lambda { @object.send(@method, true) }.should raise_error(TypeError)
- lambda { @object.send(@method, false) }.should raise_error(TypeError)
- end
-
- it "returns true inside a block opening a file if it is empty" do
- File.open(@zero_file,'w') do
- @object.send(@method, @zero_file).should == true
- end
- end
-
- platform_is_not :windows do
- it "returns false for a directory" do
- @object.send(@method, @dir).should == false
- end
- end
-
- platform_is :windows do
- # see http://redmine.ruby-lang.org/issues/show/449 for background
- it "returns true for a directory" do
- @object.send(@method, @dir).should == true
- end
- end
-end
-
-describe :file_zero_missing, shared: true do
- it "returns false if the file does not exist" do
- @object.send(@method, 'fake_file').should == false
- end
-end