From a1b4816759418ca8fe510e8739622fc5d77ab0f0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 27 Apr 2019 18:53:23 +0200 Subject: Update to ruby/spec@15c9619 --- spec/ruby/core/file/empty_spec.rb | 12 +++++------- spec/ruby/core/file/expand_path_spec.rb | 16 +++++++--------- spec/ruby/core/file/mtime_spec.rb | 2 +- spec/ruby/core/file/stat/dev_major_spec.rb | 8 +++----- spec/ruby/core/file/stat/dev_minor_spec.rb | 8 +++----- spec/ruby/core/file/stat/rdev_major_spec.rb | 8 +++----- spec/ruby/core/file/stat/rdev_minor_spec.rb | 8 +++----- spec/ruby/core/file/utime_spec.rb | 24 ++++++++++++------------ 8 files changed, 37 insertions(+), 49 deletions(-) (limited to 'spec/ruby/core/file') diff --git a/spec/ruby/core/file/empty_spec.rb b/spec/ruby/core/file/empty_spec.rb index a904f140e6..77f132303e 100644 --- a/spec/ruby/core/file/empty_spec.rb +++ b/spec/ruby/core/file/empty_spec.rb @@ -2,14 +2,12 @@ require_relative '../../spec_helper' require_relative '../../shared/file/zero' describe "File.empty?" do - ruby_version_is "2.4" do - it_behaves_like :file_zero, :empty?, File - it_behaves_like :file_zero_missing, :empty?, File + it_behaves_like :file_zero, :empty?, File + it_behaves_like :file_zero_missing, :empty?, File - platform_is :solaris do - it "returns false for /dev/null" do - File.empty?('/dev/null').should == true - end + platform_is :solaris do + it "returns false for /dev/null" do + File.empty?('/dev/null').should == true end end end diff --git a/spec/ruby/core/file/expand_path_spec.rb b/spec/ruby/core/file/expand_path_spec.rb index 6e24e62075..b03bb3a2ca 100644 --- a/spec/ruby/core/file/expand_path_spec.rb +++ b/spec/ruby/core/file/expand_path_spec.rb @@ -222,16 +222,14 @@ platform_is_not :windows do ENV["HOME"] = @home end - ruby_version_is ''...'2.4' do - it "raises an ArgumentError when passed '~' if HOME is nil" do - ENV.delete "HOME" - lambda { File.expand_path("~") }.should raise_error(ArgumentError) - end + it "uses the user database when passed '~' if HOME is nil" do + ENV.delete "HOME" + File.directory?(File.expand_path("~")).should == true + end - it "raises an ArgumentError when passed '~/' if HOME is nil" do - ENV.delete "HOME" - lambda { File.expand_path("~/") }.should raise_error(ArgumentError) - end + it "uses the user database when passed '~/' if HOME is nil" do + ENV.delete "HOME" + File.directory?(File.expand_path("~/")).should == true end it "raises an ArgumentError when passed '~' if HOME == ''" do diff --git a/spec/ruby/core/file/mtime_spec.rb b/spec/ruby/core/file/mtime_spec.rb index c5d854bb08..833f759eaa 100644 --- a/spec/ruby/core/file/mtime_spec.rb +++ b/spec/ruby/core/file/mtime_spec.rb @@ -12,7 +12,7 @@ describe "File.mtime" do it "returns the modification Time of the file" do File.mtime(@filename).should be_kind_of(Time) - File.mtime(@filename).should be_close(@mtime, 60.0) + 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 diff --git a/spec/ruby/core/file/stat/dev_major_spec.rb b/spec/ruby/core/file/stat/dev_major_spec.rb index 845c883a42..4966d609e2 100644 --- a/spec/ruby/core/file/stat/dev_major_spec.rb +++ b/spec/ruby/core/file/stat/dev_major_spec.rb @@ -9,11 +9,9 @@ describe "File::Stat#dev_major" do rm_r @name end - ruby_version_is "2.4" 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) - end + 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) 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 ddfb6a7b6a..ea79c12b99 100644 --- a/spec/ruby/core/file/stat/dev_minor_spec.rb +++ b/spec/ruby/core/file/stat/dev_minor_spec.rb @@ -9,11 +9,9 @@ describe "File::Stat#dev_minor" do rm_r @name end - ruby_version_is "2.4" 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) - end + 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) end end diff --git a/spec/ruby/core/file/stat/rdev_major_spec.rb b/spec/ruby/core/file/stat/rdev_major_spec.rb index 3d7f6ef759..f8a8d1b107 100644 --- a/spec/ruby/core/file/stat/rdev_major_spec.rb +++ b/spec/ruby/core/file/stat/rdev_major_spec.rb @@ -17,11 +17,9 @@ describe "File::Stat#rdev_major" do end end - ruby_version_is "2.4" do - 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) - 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) 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 e25c61ca86..dc30c1f56c 100644 --- a/spec/ruby/core/file/stat/rdev_minor_spec.rb +++ b/spec/ruby/core/file/stat/rdev_minor_spec.rb @@ -17,11 +17,9 @@ describe "File::Stat#rdev_minor" do end end - ruby_version_is "2.4" do - 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) - 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) end end diff --git a/spec/ruby/core/file/utime_spec.rb b/spec/ruby/core/file/utime_spec.rb index 64af82ef19..03adc76efe 100644 --- a/spec/ruby/core/file/utime_spec.rb +++ b/spec/ruby/core/file/utime_spec.rb @@ -27,10 +27,10 @@ describe "File.utime" do File.atime(@file2).should be_close(@atime, 0.0001) File.mtime(@file2).should be_close(@mtime, 0.0001) else - File.atime(@file1).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file1).to_i.should be_close(@mtime.to_i, 2) - File.atime(@file2).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file2).to_i.should be_close(@mtime.to_i, 2) + File.atime(@file1).to_i.should be_close(@atime.to_i, TIME_TOLERANCE) + File.mtime(@file1).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE) + File.atime(@file2).to_i.should be_close(@atime.to_i, TIME_TOLERANCE) + File.mtime(@file2).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE) end end @@ -43,10 +43,10 @@ describe "File.utime" do File.atime(@file2).should be_close(tn, 0.050) File.mtime(@file2).should be_close(tn, 0.050) else - File.atime(@file1).to_i.should be_close(Time.now.to_i, 2) - File.mtime(@file1).to_i.should be_close(Time.now.to_i, 2) - File.atime(@file2).to_i.should be_close(Time.now.to_i, 2) - File.mtime(@file2).to_i.should be_close(Time.now.to_i, 2) + File.atime(@file1).to_i.should be_close(Time.now.to_i, TIME_TOLERANCE) + File.mtime(@file1).to_i.should be_close(Time.now.to_i, TIME_TOLERANCE) + File.atime(@file2).to_i.should be_close(Time.now.to_i, TIME_TOLERANCE) + File.mtime(@file2).to_i.should be_close(Time.now.to_i, TIME_TOLERANCE) end end @@ -63,10 +63,10 @@ describe "File.utime" do File.mtime(@file2).should be_close(@mtime, 0.0001) else File.utime(@atime.to_i, @mtime.to_i, @file1, @file2) - File.atime(@file1).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file1).to_i.should be_close(@mtime.to_i, 2) - File.atime(@file2).to_i.should be_close(@atime.to_i, 2) - File.mtime(@file2).to_i.should be_close(@mtime.to_i, 2) + File.atime(@file1).to_i.should be_close(@atime.to_i, TIME_TOLERANCE) + File.mtime(@file1).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE) + File.atime(@file2).to_i.should be_close(@atime.to_i, TIME_TOLERANCE) + File.mtime(@file2).to_i.should be_close(@mtime.to_i, TIME_TOLERANCE) end end -- cgit v1.2.3