aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/file
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-08 19:43:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-04-01 15:36:20 +0900
commit826f44834fe11f3f9c52343443a15b6c83466889 (patch)
treef2c2abed62db1c750515cd8b0fbac6442b6d4200 /spec/ruby/core/file
parent3a2073e61b6ccce6d07d31ebd89d4c385b9a55f2 (diff)
downloadruby-826f44834fe11f3f9c52343443a15b6c83466889.tar.gz
Drop support for ruby 2.4 from ruby/spec
Diffstat (limited to 'spec/ruby/core/file')
-rw-r--r--spec/ruby/core/file/atime_spec.rb2
-rw-r--r--spec/ruby/core/file/ctime_spec.rb2
-rw-r--r--spec/ruby/core/file/lutime_spec.rb58
-rw-r--r--spec/ruby/core/file/mtime_spec.rb2
-rw-r--r--spec/ruby/core/file/open_spec.rb10
-rw-r--r--spec/ruby/core/file/shared/path.rb32
6 files changed, 50 insertions, 56 deletions
diff --git a/spec/ruby/core/file/atime_spec.rb b/spec/ruby/core/file/atime_spec.rb
index 02e8412722..b9b5db876c 100644
--- a/spec/ruby/core/file/atime_spec.rb
+++ b/spec/ruby/core/file/atime_spec.rb
@@ -15,7 +15,7 @@ describe "File.atime" do
File.atime(@file).should be_kind_of(Time)
end
- guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do
+ guard -> { platform_is :linux or platform_is :windows } do
## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed.
it "returns the last access time for the named file with microseconds" do
supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10)
diff --git a/spec/ruby/core/file/ctime_spec.rb b/spec/ruby/core/file/ctime_spec.rb
index 68a9fa43cb..fff74b1d40 100644
--- a/spec/ruby/core/file/ctime_spec.rb
+++ b/spec/ruby/core/file/ctime_spec.rb
@@ -14,7 +14,7 @@ describe "File.ctime" do
File.ctime(@file).should be_kind_of(Time)
end
- guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do
+ guard -> { platform_is :linux or platform_is :windows } do
it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do
supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10)
if supports_subseconds != 0
diff --git a/spec/ruby/core/file/lutime_spec.rb b/spec/ruby/core/file/lutime_spec.rb
index 7449bc4389..1f0625f61e 100644
--- a/spec/ruby/core/file/lutime_spec.rb
+++ b/spec/ruby/core/file/lutime_spec.rb
@@ -1,40 +1,38 @@
require_relative '../../spec_helper'
-ruby_version_is "2.5" do
- describe "File.lutime" do
- platform_is_not :windows do
- before :each do
- @atime = Time.utc(2000)
- @mtime = Time.utc(2001)
- @file = tmp("specs_lutime_file")
- @symlink = tmp("specs_lutime_symlink")
- touch @file
- File.symlink(@file, @symlink)
- end
+describe "File.lutime" do
+ platform_is_not :windows do
+ before :each do
+ @atime = Time.utc(2000)
+ @mtime = Time.utc(2001)
+ @file = tmp("specs_lutime_file")
+ @symlink = tmp("specs_lutime_symlink")
+ touch @file
+ File.symlink(@file, @symlink)
+ end
- after :each do
- rm_r @file, @symlink
- end
+ after :each do
+ rm_r @file, @symlink
+ end
- it "sets the access and modification time for a regular file" do
- File.lutime(@atime, @mtime, @file)
- stat = File.stat(@file)
- stat.atime.should == @atime
- stat.mtime.should === @mtime
- end
+ it "sets the access and modification time for a regular file" do
+ File.lutime(@atime, @mtime, @file)
+ stat = File.stat(@file)
+ stat.atime.should == @atime
+ stat.mtime.should === @mtime
+ end
- it "sets the access and modification time for a symlink" do
- original = File.stat(@file)
+ it "sets the access and modification time for a symlink" do
+ original = File.stat(@file)
- File.lutime(@atime, @mtime, @symlink)
- stat = File.lstat(@symlink)
- stat.atime.should == @atime
- stat.mtime.should === @mtime
+ File.lutime(@atime, @mtime, @symlink)
+ stat = File.lstat(@symlink)
+ stat.atime.should == @atime
+ stat.mtime.should === @mtime
- file = File.stat(@file)
- file.atime.should == original.atime
- file.mtime.should == original.mtime
- end
+ file = File.stat(@file)
+ file.atime.should == original.atime
+ file.mtime.should == original.mtime
end
end
end
diff --git a/spec/ruby/core/file/mtime_spec.rb b/spec/ruby/core/file/mtime_spec.rb
index 1941e2ff85..02f6fc4637 100644
--- a/spec/ruby/core/file/mtime_spec.rb
+++ b/spec/ruby/core/file/mtime_spec.rb
@@ -15,7 +15,7 @@ describe "File.mtime" do
File.mtime(@filename).should be_close(@mtime, TIME_TOLERANCE)
end
- guard -> { platform_is :linux or (platform_is :windows and ruby_version_is '2.5') } do
+ guard -> { platform_is :linux or platform_is :windows } do
it "returns the modification Time of the file with microseconds" do
supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10)
if supports_subseconds != 0
diff --git a/spec/ruby/core/file/open_spec.rb b/spec/ruby/core/file/open_spec.rb
index e3c5618795..7ceeb47dd8 100644
--- a/spec/ruby/core/file/open_spec.rb
+++ b/spec/ruby/core/file/open_spec.rb
@@ -623,12 +623,10 @@ describe "File.open" do
end
end
- ruby_version_is "2.5" do
- it "raises ArgumentError if mixing :newline and binary mode" do
- -> {
- File.open(@file, "rb", newline: :universal) {}
- }.should raise_error(ArgumentError, "newline decorator with binary mode")
- end
+ it "raises ArgumentError if mixing :newline and binary mode" do
+ -> {
+ File.open(@file, "rb", newline: :universal) {}
+ }.should raise_error(ArgumentError, "newline decorator with binary mode")
end
ruby_version_is "2.6" do
diff --git a/spec/ruby/core/file/shared/path.rb b/spec/ruby/core/file/shared/path.rb
index cfd119f799..d964acc855 100644
--- a/spec/ruby/core/file/shared/path.rb
+++ b/spec/ruby/core/file/shared/path.rb
@@ -50,26 +50,24 @@ describe :file_path, shared: true do
@file.send(@method).encoding.should == Encoding.find("euc-jp")
end
- ruby_version_is "2.5" do
- platform_is :linux do
- guard -> { defined?(File::TMPFILE) } do
- before :each do
- @dir = tmp("tmpfilespec")
- mkdir_p @dir
- end
+ platform_is :linux do
+ guard -> { defined?(File::TMPFILE) } do
+ before :each do
+ @dir = tmp("tmpfilespec")
+ mkdir_p @dir
+ end
- after :each do
- rm_r @dir
- end
+ after :each do
+ rm_r @dir
+ end
- it "raises IOError if file was opened with File::TMPFILE" do
- begin
- File.open(@dir, File::RDWR | File::TMPFILE) do |f|
- -> { f.send(@method) }.should raise_error(IOError)
- end
- rescue Errno::EOPNOTSUPP, Errno::EINVAL, Errno::EISDIR
- skip "no support from the filesystem"
+ it "raises IOError if file was opened with File::TMPFILE" do
+ begin
+ File.open(@dir, File::RDWR | File::TMPFILE) do |f|
+ -> { f.send(@method) }.should raise_error(IOError)
end
+ rescue Errno::EOPNOTSUPP, Errno::EINVAL, Errno::EISDIR
+ skip "no support from the filesystem"
end
end
end