summaryrefslogtreecommitdiff
path: root/spec/ruby/core/file/stat
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/file/stat')
-rw-r--r--spec/ruby/core/file/stat/atime_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/birthtime_spec.rb38
-rw-r--r--spec/ruby/core/file/stat/blksize_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/blockdev_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/blocks_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/chardev_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/comparison_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/ctime_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/dev_major_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/dev_minor_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/dev_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/directory_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/executable_real_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/executable_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/file_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/ftype_spec.rb10
-rw-r--r--spec/ruby/core/file/stat/gid_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/grpowned_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/ino_spec.rb22
-rw-r--r--spec/ruby/core/file/stat/inspect_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/mode_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/mtime_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/new_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/nlink_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/owned_spec.rb20
-rw-r--r--spec/ruby/core/file/stat/pipe_spec.rb12
-rw-r--r--spec/ruby/core/file/stat/rdev_major_spec.rb19
-rw-r--r--spec/ruby/core/file/stat/rdev_minor_spec.rb19
-rw-r--r--spec/ruby/core/file/stat/rdev_spec.rb4
-rw-r--r--spec/ruby/core/file/stat/readable_real_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/readable_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/setgid_spec.rb10
-rw-r--r--spec/ruby/core/file/stat/setuid_spec.rb10
-rw-r--r--spec/ruby/core/file/stat/size_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/socket_spec.rb10
-rw-r--r--spec/ruby/core/file/stat/sticky_spec.rb10
-rw-r--r--spec/ruby/core/file/stat/symlink_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/uid_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/world_readable_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/world_writable_spec.rb8
-rw-r--r--spec/ruby/core/file/stat/writable_real_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/writable_spec.rb6
-rw-r--r--spec/ruby/core/file/stat/zero_spec.rb6
43 files changed, 156 insertions, 194 deletions
diff --git a/spec/ruby/core/file/stat/atime_spec.rb b/spec/ruby/core/file/stat/atime_spec.rb
index 575c98ce44..2fecaed300 100644
--- a/spec/ruby/core/file/stat/atime_spec.rb
+++ b/spec/ruby/core/file/stat/atime_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#atime" do
before :each do
@@ -12,7 +12,7 @@ describe "File::Stat#atime" do
it "returns the atime of a File::Stat object" do
st = File.stat(@file)
- st.atime.should be_kind_of(Time)
+ st.atime.should.is_a?(Time)
st.atime.should <= Time.now
end
end
diff --git a/spec/ruby/core/file/stat/birthtime_spec.rb b/spec/ruby/core/file/stat/birthtime_spec.rb
index c2ccc319f1..728f635397 100644
--- a/spec/ruby/core/file/stat/birthtime_spec.rb
+++ b/spec/ruby/core/file/stat/birthtime_spec.rb
@@ -1,27 +1,29 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
-describe "File::Stat#birthtime" do
- before :each do
- @file = tmp('i_exist')
- touch(@file) { |f| f.write "rubinius" }
- end
+platform_is(:windows, :darwin, :freebsd, :netbsd,
+ *ruby_version_is("4.0") { :linux },
+ ) do
+ not_implemented_messages = [
+ "birthtime() function is unimplemented", # unsupported OS/version
+ "birthtime is unimplemented", # unsupported filesystem
+ ]
- after :each do
- rm_r @file
- end
+ describe "File::Stat#birthtime" do
+ before :each do
+ @file = tmp('i_exist')
+ touch(@file) { |f| f.write "rubinius" }
+ end
- platform_is :windows, :darwin, :freebsd, :netbsd do
- it "returns the birthtime of a File::Stat object" do
- st = File.stat(@file)
- st.birthtime.should be_kind_of(Time)
- st.birthtime.should <= Time.now
+ after :each do
+ rm_r @file
end
- end
- platform_is :linux, :openbsd do
- it "raises an NotImplementedError" do
+ it "returns the birthtime of a File::Stat object" do
st = File.stat(@file)
- lambda { st.birthtime }.should raise_error(NotImplementedError)
+ st.birthtime.should.is_a?(Time)
+ st.birthtime.should <= Time.now
+ rescue NotImplementedError => e
+ e.message.should.start_with?(*not_implemented_messages)
end
end
end
diff --git a/spec/ruby/core/file/stat/blksize_spec.rb b/spec/ruby/core/file/stat/blksize_spec.rb
index 4399e6b4bb..4d85b05e4d 100644
--- a/spec/ruby/core/file/stat/blksize_spec.rb
+++ b/spec/ruby/core/file/stat/blksize_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#blksize" do
before :each do
diff --git a/spec/ruby/core/file/stat/blockdev_spec.rb b/spec/ruby/core/file/stat/blockdev_spec.rb
index 440291f130..f986c18125 100644
--- a/spec/ruby/core/file/stat/blockdev_spec.rb
+++ b/spec/ruby/core/file/stat/blockdev_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/blockdev', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/blockdev'
+require_relative 'fixtures/classes'
describe "File::Stat#blockdev?" do
it_behaves_like :file_blockdev, :blockdev?, FileStat
diff --git a/spec/ruby/core/file/stat/blocks_spec.rb b/spec/ruby/core/file/stat/blocks_spec.rb
index ca0fd2c8a6..5e0efc8bc2 100644
--- a/spec/ruby/core/file/stat/blocks_spec.rb
+++ b/spec/ruby/core/file/stat/blocks_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#blocks" do
before :each do
@@ -11,17 +11,17 @@ describe "File::Stat#blocks" do
end
platform_is_not :windows do
- it "returns the blocks of a File::Stat object" do
+ it "returns a non-negative integer" do
st = File.stat(@file)
st.blocks.is_a?(Integer).should == true
- st.blocks.should > 0
+ st.blocks.should >= 0
end
end
platform_is :windows do
it "returns nil" do
st = File.stat(@file)
- st.blocks.should be_nil
+ st.blocks.should == nil
end
end
end
diff --git a/spec/ruby/core/file/stat/chardev_spec.rb b/spec/ruby/core/file/stat/chardev_spec.rb
index 25c8c877f7..622fb2052d 100644
--- a/spec/ruby/core/file/stat/chardev_spec.rb
+++ b/spec/ruby/core/file/stat/chardev_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/chardev', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/chardev'
+require_relative 'fixtures/classes'
describe "File::Stat#chardev?" do
it_behaves_like :file_chardev, :chardev?, FileStat
diff --git a/spec/ruby/core/file/stat/comparison_spec.rb b/spec/ruby/core/file/stat/comparison_spec.rb
index a70a083ab2..faa3b6bf62 100644
--- a/spec/ruby/core/file/stat/comparison_spec.rb
+++ b/spec/ruby/core/file/stat/comparison_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#<=>" do
before :each do
diff --git a/spec/ruby/core/file/stat/ctime_spec.rb b/spec/ruby/core/file/stat/ctime_spec.rb
index 2f82dfdab6..dbf43a7453 100644
--- a/spec/ruby/core/file/stat/ctime_spec.rb
+++ b/spec/ruby/core/file/stat/ctime_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#ctime" do
before :each do
@@ -12,7 +12,7 @@ describe "File::Stat#ctime" do
it "returns the ctime of a File::Stat object" do
st = File.stat(@file)
- st.ctime.should be_kind_of(Time)
+ st.ctime.should.is_a?(Time)
st.ctime.should <= Time.now
end
end
diff --git a/spec/ruby/core/file/stat/dev_major_spec.rb b/spec/ruby/core/file/stat/dev_major_spec.rb
index 0b00fc4d36..a199eaaa11 100644
--- a/spec/ruby/core/file/stat/dev_major_spec.rb
+++ b/spec/ruby/core/file/stat/dev_major_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#dev_major" do
before :each do
@@ -11,13 +11,13 @@ describe "File::Stat#dev_major" do
platform_is_not :windows do
it "returns the major part of File::Stat#dev" do
- File.stat(@name).dev_major.should be_kind_of(Integer)
+ File.stat(@name).dev_major.should.is_a?(Integer)
end
end
platform_is :windows do
it "returns nil" do
- File.stat(@name).dev_major.should be_nil
+ File.stat(@name).dev_major.should == nil
end
end
end
diff --git a/spec/ruby/core/file/stat/dev_minor_spec.rb b/spec/ruby/core/file/stat/dev_minor_spec.rb
index 0475e3be81..8ce94778ca 100644
--- a/spec/ruby/core/file/stat/dev_minor_spec.rb
+++ b/spec/ruby/core/file/stat/dev_minor_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#dev_minor" do
before :each do
@@ -11,13 +11,13 @@ describe "File::Stat#dev_minor" do
platform_is_not :windows do
it "returns the minor part of File::Stat#dev" do
- File.stat(@name).dev_minor.should be_kind_of(Integer)
+ File.stat(@name).dev_minor.should.is_a?(Integer)
end
end
platform_is :windows do
it "returns nil" do
- File.stat(@name).dev_minor.should be_nil
+ File.stat(@name).dev_minor.should == nil
end
end
end
diff --git a/spec/ruby/core/file/stat/dev_spec.rb b/spec/ruby/core/file/stat/dev_spec.rb
index 3cdc704fd7..cd5e3d175e 100644
--- a/spec/ruby/core/file/stat/dev_spec.rb
+++ b/spec/ruby/core/file/stat/dev_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#dev" do
before :each do
@@ -10,6 +10,6 @@ describe "File::Stat#dev" do
end
it "returns the number of the device on which the file exists" do
- File.stat(@name).dev.should be_kind_of(Integer)
+ File.stat(@name).dev.should.is_a?(Integer)
end
end
diff --git a/spec/ruby/core/file/stat/directory_spec.rb b/spec/ruby/core/file/stat/directory_spec.rb
index 5ead2dca49..c03610388b 100644
--- a/spec/ruby/core/file/stat/directory_spec.rb
+++ b/spec/ruby/core/file/stat/directory_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/directory', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/directory'
+require_relative 'fixtures/classes'
describe "File::Stat#directory?" do
it_behaves_like :file_directory, :directory?, FileStat
diff --git a/spec/ruby/core/file/stat/executable_real_spec.rb b/spec/ruby/core/file/stat/executable_real_spec.rb
index 11de0a5b39..23bffe89c5 100644
--- a/spec/ruby/core/file/stat/executable_real_spec.rb
+++ b/spec/ruby/core/file/stat/executable_real_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/executable_real', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/executable_real'
+require_relative 'fixtures/classes'
describe "File::Stat#executable_real?" do
it_behaves_like :file_executable_real, :executable_real?, FileStat
diff --git a/spec/ruby/core/file/stat/executable_spec.rb b/spec/ruby/core/file/stat/executable_spec.rb
index e3b1093056..422975d14b 100644
--- a/spec/ruby/core/file/stat/executable_spec.rb
+++ b/spec/ruby/core/file/stat/executable_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/executable', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/executable'
+require_relative 'fixtures/classes'
describe "File::Stat#executable?" do
it_behaves_like :file_executable, :executable?, FileStat
diff --git a/spec/ruby/core/file/stat/file_spec.rb b/spec/ruby/core/file/stat/file_spec.rb
index da79dddb00..d141536b4b 100644
--- a/spec/ruby/core/file/stat/file_spec.rb
+++ b/spec/ruby/core/file/stat/file_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/file', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/file'
+require_relative 'fixtures/classes'
describe "File::Stat#file?" do
it_behaves_like :file_file, :file?, FileStat
diff --git a/spec/ruby/core/file/stat/ftype_spec.rb b/spec/ruby/core/file/stat/ftype_spec.rb
index 588c371c39..df2e3ada1e 100644
--- a/spec/ruby/core/file/stat/ftype_spec.rb
+++ b/spec/ruby/core/file/stat/ftype_spec.rb
@@ -1,5 +1,5 @@
-require "#{File.dirname(__FILE__)}/../../../spec_helper"
-require "#{File.dirname(__FILE__)}/../fixtures/file_types"
+require_relative '../../../spec_helper'
+require_relative '../fixtures/file_types'
describe "File::Stat#ftype" do
before :all do
@@ -8,7 +8,7 @@ describe "File::Stat#ftype" do
it "returns a String" do
FileSpecs.normal_file do |file|
- File.lstat(file).ftype.should be_kind_of(String)
+ File.lstat(file).ftype.should.is_a?(String)
end
end
@@ -55,10 +55,6 @@ describe "File::Stat#ftype" do
end
end
- # This will silently not execute the block if no socket
- # can be found. However, if you are running X, there is
- # a good chance that if nothing else, at least the X
- # Server socket exists.
it "returns 'socket' when the file is a socket" do
FileSpecs.socket do |socket|
File.lstat(socket).ftype.should == 'socket'
diff --git a/spec/ruby/core/file/stat/gid_spec.rb b/spec/ruby/core/file/stat/gid_spec.rb
index 27356b6401..3bba65bc82 100644
--- a/spec/ruby/core/file/stat/gid_spec.rb
+++ b/spec/ruby/core/file/stat/gid_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#gid" do
before :each do
diff --git a/spec/ruby/core/file/stat/grpowned_spec.rb b/spec/ruby/core/file/stat/grpowned_spec.rb
index 07a52876d0..e7278e229b 100644
--- a/spec/ruby/core/file/stat/grpowned_spec.rb
+++ b/spec/ruby/core/file/stat/grpowned_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/grpowned', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/grpowned'
+require_relative 'fixtures/classes'
describe "File::Stat#grpowned?" do
it_behaves_like :file_grpowned, :grpowned?, FileStat
diff --git a/spec/ruby/core/file/stat/ino_spec.rb b/spec/ruby/core/file/stat/ino_spec.rb
index 0339dee54f..c09b6448c7 100644
--- a/spec/ruby/core/file/stat/ino_spec.rb
+++ b/spec/ruby/core/file/stat/ino_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#ino" do
before :each do
@@ -13,26 +13,16 @@ describe "File::Stat#ino" do
platform_is_not :windows do
it "returns the ino of a File::Stat object" do
st = File.stat(@file)
- st.ino.should be_kind_of(Integer)
+ st.ino.should.is_a?(Integer)
st.ino.should > 0
end
end
platform_is :windows do
- ruby_version_is ""..."2.3" do
- it "returns 0" do
- st = File.stat(@file)
- st.ino.should be_kind_of(Integer)
- st.ino.should == 0
- end
- end
-
- ruby_version_is "2.3" do
- it "returns BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low of a File::Stat object" do
- st = File.stat(@file)
- st.ino.should be_kind_of(Integer)
- st.ino.should > 0
- end
+ it "returns BY_HANDLE_FILE_INFORMATION.nFileIndexHigh/Low of a File::Stat object" do
+ st = File.stat(@file)
+ st.ino.should.is_a?(Integer)
+ st.ino.should > 0
end
end
end
diff --git a/spec/ruby/core/file/stat/inspect_spec.rb b/spec/ruby/core/file/stat/inspect_spec.rb
index dd2ad21da3..1613b427d0 100644
--- a/spec/ruby/core/file/stat/inspect_spec.rb
+++ b/spec/ruby/core/file/stat/inspect_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#inspect" do
@@ -15,10 +15,10 @@ describe "File::Stat#inspect" do
st = File.stat(@file)
expected = "#<File::Stat dev=0x#{st.dev.to_s(16)}, ino=#{st.ino}, mode=#{sprintf("%07o", st.mode)}, nlink=#{st.nlink}"
expected << ", uid=#{st.uid}, gid=#{st.gid}, rdev=0x#{st.rdev.to_s(16)}, size=#{st.size}, blksize=#{st.blksize.inspect}"
- expected << ", blocks=#{st.blocks.inspect}, atime=#{st.atime}, mtime=#{st.mtime}, ctime=#{st.ctime}"
- platform_is :bsd, :darwin do
+ expected << ", blocks=#{st.blocks.inspect}, atime=#{st.atime.inspect}, mtime=#{st.mtime.inspect}, ctime=#{st.ctime.inspect}"
+ platform_is :netbsd, :freebsd, :darwin do
# Windows has File.birthtime but it's not here since already shown by ctime.
- expected << ", birthtime=#{st.birthtime}"
+ expected << ", birthtime=#{st.birthtime.inspect}"
end
expected << ">"
st.inspect.should == expected
diff --git a/spec/ruby/core/file/stat/mode_spec.rb b/spec/ruby/core/file/stat/mode_spec.rb
index 1c895bf0ce..c85fb85a58 100644
--- a/spec/ruby/core/file/stat/mode_spec.rb
+++ b/spec/ruby/core/file/stat/mode_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#mode" do
before :each do
diff --git a/spec/ruby/core/file/stat/mtime_spec.rb b/spec/ruby/core/file/stat/mtime_spec.rb
index 9dd20dfd65..7844491212 100644
--- a/spec/ruby/core/file/stat/mtime_spec.rb
+++ b/spec/ruby/core/file/stat/mtime_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#mtime" do
before :each do
@@ -12,7 +12,7 @@ describe "File::Stat#mtime" do
it "returns the mtime of a File::Stat object" do
st = File.stat(@file)
- st.mtime.should be_kind_of(Time)
+ st.mtime.should.is_a?(Time)
st.mtime.should <= Time.now
end
end
diff --git a/spec/ruby/core/file/stat/new_spec.rb b/spec/ruby/core/file/stat/new_spec.rb
index ec7d81362f..b8c3600028 100644
--- a/spec/ruby/core/file/stat/new_spec.rb
+++ b/spec/ruby/core/file/stat/new_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#initialize" do
@@ -13,12 +13,14 @@ describe "File::Stat#initialize" do
end
it "raises an exception if the file doesn't exist" do
- lambda { File::Stat.new(tmp("i_am_a_dummy_file_that_doesnt_exist")) }.should raise_error
+ -> {
+ File::Stat.new(tmp("i_am_a_dummy_file_that_doesnt_exist"))
+ }.should.raise(Errno::ENOENT)
end
it "creates a File::Stat object for the given file" do
st = File::Stat.new(@file)
- st.should be_kind_of(File::Stat)
+ st.should.is_a?(File::Stat)
st.ftype.should == 'file'
end
diff --git a/spec/ruby/core/file/stat/nlink_spec.rb b/spec/ruby/core/file/stat/nlink_spec.rb
index e857b07fd1..7143923cfc 100644
--- a/spec/ruby/core/file/stat/nlink_spec.rb
+++ b/spec/ruby/core/file/stat/nlink_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#nlink" do
before :each do
@@ -11,7 +11,7 @@ describe "File::Stat#nlink" do
rm_r @link, @file
end
- platform_is_not :windows do
+ platform_is_not :windows, :android do
it "returns the number of links to a file" do
File::Stat.new(@file).nlink.should == 1
File.link(@file, @link)
diff --git a/spec/ruby/core/file/stat/owned_spec.rb b/spec/ruby/core/file/stat/owned_spec.rb
index 4c4d843bbe..a23ad850c5 100644
--- a/spec/ruby/core/file/stat/owned_spec.rb
+++ b/spec/ruby/core/file/stat/owned_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/owned', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/owned'
+require_relative 'fixtures/classes'
describe "File::Stat#owned?" do
it_behaves_like :file_owned, :owned?, FileStat
@@ -18,14 +18,16 @@ describe "File::Stat#owned?" do
it "returns true if the file is owned by the user" do
st = File.stat(@file)
- st.owned?.should == true
+ st.should.owned?
end
- platform_is_not :windows do
- it "returns false if the file is not owned by the user" do
- system_file = '/etc/passwd'
- st = File.stat(system_file)
- st.owned?.should == false
+ platform_is_not :windows, :android do
+ as_user do
+ it "returns false if the file is not owned by the user" do
+ system_file = '/etc/passwd'
+ st = File.stat(system_file)
+ st.should_not.owned?
+ end
end
end
end
diff --git a/spec/ruby/core/file/stat/pipe_spec.rb b/spec/ruby/core/file/stat/pipe_spec.rb
index e4c0b559bb..692dfbf42a 100644
--- a/spec/ruby/core/file/stat/pipe_spec.rb
+++ b/spec/ruby/core/file/stat/pipe_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/pipe', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/pipe'
+require_relative 'fixtures/classes'
describe "File::Stat#pipe?" do
it_behaves_like :file_pipe, :pipe?, FileStat
@@ -12,7 +12,7 @@ describe "File::Stat#pipe?" do
touch(filename)
st = File.stat(filename)
- st.pipe?.should == false
+ st.should_not.pipe?
rm_r filename
end
@@ -20,10 +20,10 @@ describe "File::Stat#pipe?" do
platform_is_not :windows do
it "returns true if the file is a pipe" do
filename = tmp("i_am_a_pipe")
- system "mkfifo #{filename}"
+ File.mkfifo(filename)
st = File.stat(filename)
- st.pipe?.should == true
+ st.should.pipe?
rm_r filename
end
diff --git a/spec/ruby/core/file/stat/rdev_major_spec.rb b/spec/ruby/core/file/stat/rdev_major_spec.rb
index f9d514fbc0..e1b44fc2d0 100644
--- a/spec/ruby/core/file/stat/rdev_major_spec.rb
+++ b/spec/ruby/core/file/stat/rdev_major_spec.rb
@@ -1,31 +1,24 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#rdev_major" do
before :each do
- platform_is :solaris do
- @name = "/dev/zfs"
- end
- platform_is_not :solaris do
- @name = tmp("file.txt")
- touch(@name)
- end
+ @name = tmp("file.txt")
+ touch(@name)
end
after :each do
- platform_is_not :solaris do
- rm_r @name
- end
+ rm_r @name
end
platform_is_not :windows do
it "returns the major part of File::Stat#rdev" do
- File.stat(@name).rdev_major.should be_kind_of(Integer)
+ File.stat(@name).rdev_major.should.is_a?(Integer)
end
end
platform_is :windows do
it "returns nil" do
- File.stat(@name).rdev_major.should be_nil
+ File.stat(@name).rdev_major.should == nil
end
end
end
diff --git a/spec/ruby/core/file/stat/rdev_minor_spec.rb b/spec/ruby/core/file/stat/rdev_minor_spec.rb
index 67399c5e68..8af3b9f587 100644
--- a/spec/ruby/core/file/stat/rdev_minor_spec.rb
+++ b/spec/ruby/core/file/stat/rdev_minor_spec.rb
@@ -1,31 +1,24 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#rdev_minor" do
before :each do
- platform_is :solaris do
- @name = "/dev/zfs"
- end
- platform_is_not :solaris do
- @name = tmp("file.txt")
- touch(@name)
- end
+ @name = tmp("file.txt")
+ touch(@name)
end
after :each do
- platform_is_not :solaris do
- rm_r @name
- end
+ rm_r @name
end
platform_is_not :windows do
it "returns the minor part of File::Stat#rdev" do
- File.stat(@name).rdev_minor.should be_kind_of(Integer)
+ File.stat(@name).rdev_minor.should.is_a?(Integer)
end
end
platform_is :windows do
it "returns nil" do
- File.stat(@name).rdev_minor.should be_nil
+ File.stat(@name).rdev_minor.should == nil
end
end
end
diff --git a/spec/ruby/core/file/stat/rdev_spec.rb b/spec/ruby/core/file/stat/rdev_spec.rb
index 12f97fb044..7e4252fcc6 100644
--- a/spec/ruby/core/file/stat/rdev_spec.rb
+++ b/spec/ruby/core/file/stat/rdev_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#rdev" do
before :each do
@@ -10,6 +10,6 @@ describe "File::Stat#rdev" do
end
it "returns the number of the device this file represents which the file exists" do
- File.stat(@name).rdev.should be_kind_of(Integer)
+ File.stat(@name).rdev.should.is_a?(Integer)
end
end
diff --git a/spec/ruby/core/file/stat/readable_real_spec.rb b/spec/ruby/core/file/stat/readable_real_spec.rb
index 49412f1df2..f138fd7b00 100644
--- a/spec/ruby/core/file/stat/readable_real_spec.rb
+++ b/spec/ruby/core/file/stat/readable_real_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/readable_real', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/readable_real'
+require_relative 'fixtures/classes'
describe "File::Stat#readable_real?" do
it_behaves_like :file_readable_real, :readable_real?, FileStat
diff --git a/spec/ruby/core/file/stat/readable_spec.rb b/spec/ruby/core/file/stat/readable_spec.rb
index 3d81975309..e99e48feed 100644
--- a/spec/ruby/core/file/stat/readable_spec.rb
+++ b/spec/ruby/core/file/stat/readable_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/readable', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/readable'
+require_relative 'fixtures/classes'
describe "File::Stat#readable?" do
it_behaves_like :file_readable, :readable?, FileStat
diff --git a/spec/ruby/core/file/stat/setgid_spec.rb b/spec/ruby/core/file/stat/setgid_spec.rb
index 318a72b437..c0748ede57 100644
--- a/spec/ruby/core/file/stat/setgid_spec.rb
+++ b/spec/ruby/core/file/stat/setgid_spec.rb
@@ -1,11 +1,7 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/setgid', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/setgid'
+require_relative 'fixtures/classes'
describe "File::Stat#setgid?" do
it_behaves_like :file_setgid, :setgid?, FileStat
end
-
-describe "File::Stat#setgid?" do
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/ruby/core/file/stat/setuid_spec.rb b/spec/ruby/core/file/stat/setuid_spec.rb
index 5057af0ccc..6408120fc4 100644
--- a/spec/ruby/core/file/stat/setuid_spec.rb
+++ b/spec/ruby/core/file/stat/setuid_spec.rb
@@ -1,11 +1,7 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/setuid', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/setuid'
+require_relative 'fixtures/classes'
describe "File::Stat#setuid?" do
it_behaves_like :file_setuid, :setuid?, FileStat
end
-
-describe "File::Stat#setuid?" do
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/ruby/core/file/stat/size_spec.rb b/spec/ruby/core/file/stat/size_spec.rb
index 84db12d591..4b4f57f8c8 100644
--- a/spec/ruby/core/file/stat/size_spec.rb
+++ b/spec/ruby/core/file/stat/size_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/size', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/size'
+require_relative 'fixtures/classes'
describe "File::Stat.size?" do
it_behaves_like :file_size, :size?, FileStat
diff --git a/spec/ruby/core/file/stat/socket_spec.rb b/spec/ruby/core/file/stat/socket_spec.rb
index b25d9314f9..09740be110 100644
--- a/spec/ruby/core/file/stat/socket_spec.rb
+++ b/spec/ruby/core/file/stat/socket_spec.rb
@@ -1,11 +1,7 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/socket', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/socket'
+require_relative 'fixtures/classes'
describe "File::Stat#socket?" do
it_behaves_like :file_socket, :socket?, FileStat
end
-
-describe "File::Stat#socket?" do
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/ruby/core/file/stat/sticky_spec.rb b/spec/ruby/core/file/stat/sticky_spec.rb
index c2fefbe106..7083e644e9 100644
--- a/spec/ruby/core/file/stat/sticky_spec.rb
+++ b/spec/ruby/core/file/stat/sticky_spec.rb
@@ -1,11 +1,7 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/sticky', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/sticky'
+require_relative 'fixtures/classes'
describe "File::Stat#sticky?" do
it_behaves_like :file_sticky, :sticky?, FileStat
end
-
-describe "File::Stat#sticky?" do
- it "needs to be reviewed for spec completeness"
-end
diff --git a/spec/ruby/core/file/stat/symlink_spec.rb b/spec/ruby/core/file/stat/symlink_spec.rb
index 579c1de0ad..0def832a4c 100644
--- a/spec/ruby/core/file/stat/symlink_spec.rb
+++ b/spec/ruby/core/file/stat/symlink_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/symlink', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/symlink'
+require_relative 'fixtures/classes'
describe "File::Stat#symlink?" do
it_behaves_like :file_symlink, :symlink?, FileStat
diff --git a/spec/ruby/core/file/stat/uid_spec.rb b/spec/ruby/core/file/stat/uid_spec.rb
index 75be97c234..b97147db21 100644
--- a/spec/ruby/core/file/stat/uid_spec.rb
+++ b/spec/ruby/core/file/stat/uid_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "File::Stat#uid" do
before :each do
diff --git a/spec/ruby/core/file/stat/world_readable_spec.rb b/spec/ruby/core/file/stat/world_readable_spec.rb
index 178e39a1ea..d94a02205e 100644
--- a/spec/ruby/core/file/stat/world_readable_spec.rb
+++ b/spec/ruby/core/file/stat/world_readable_spec.rb
@@ -1,9 +1,9 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/world_readable', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/world_readable'
+require_relative 'fixtures/classes'
describe "File::Stat.world_readable?" do
- it_behaves_like(:file_world_readable, :world_readable?, FileStat)
+ it_behaves_like :file_world_readable, :world_readable?, FileStat
end
describe "File::Stat#world_readable?" do
diff --git a/spec/ruby/core/file/stat/world_writable_spec.rb b/spec/ruby/core/file/stat/world_writable_spec.rb
index 73a7c6d3ed..8100008344 100644
--- a/spec/ruby/core/file/stat/world_writable_spec.rb
+++ b/spec/ruby/core/file/stat/world_writable_spec.rb
@@ -1,9 +1,9 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/world_writable', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/world_writable'
+require_relative 'fixtures/classes'
describe "File::Stat.world_writable?" do
- it_behaves_like(:file_world_writable, :world_writable?, FileStat)
+ it_behaves_like :file_world_writable, :world_writable?, FileStat
end
describe "File::Stat#world_writable?" do
diff --git a/spec/ruby/core/file/stat/writable_real_spec.rb b/spec/ruby/core/file/stat/writable_real_spec.rb
index e069db507b..4c9e78eb70 100644
--- a/spec/ruby/core/file/stat/writable_real_spec.rb
+++ b/spec/ruby/core/file/stat/writable_real_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/writable_real', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/writable_real'
+require_relative 'fixtures/classes'
describe "File::Stat#writable_real?" do
it_behaves_like :file_writable_real, :writable_real?, FileStat
diff --git a/spec/ruby/core/file/stat/writable_spec.rb b/spec/ruby/core/file/stat/writable_spec.rb
index b720e59f81..551268751f 100644
--- a/spec/ruby/core/file/stat/writable_spec.rb
+++ b/spec/ruby/core/file/stat/writable_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/writable', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/writable'
+require_relative 'fixtures/classes'
describe "File::Stat#writable?" do
it_behaves_like :file_writable, :writable?, FileStat
diff --git a/spec/ruby/core/file/stat/zero_spec.rb b/spec/ruby/core/file/stat/zero_spec.rb
index 127c706b90..74facac66a 100644
--- a/spec/ruby/core/file/stat/zero_spec.rb
+++ b/spec/ruby/core/file/stat/zero_spec.rb
@@ -1,6 +1,6 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../../../shared/file/zero', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../../spec_helper'
+require_relative '../../../shared/file/zero'
+require_relative 'fixtures/classes'
describe "File::Stat#zero?" do
it_behaves_like :file_zero, :zero?, FileStat