diff options
Diffstat (limited to 'spec/ruby/core/file/stat_spec.rb')
| -rw-r--r-- | spec/ruby/core/file/stat_spec.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/spec/ruby/core/file/stat_spec.rb b/spec/ruby/core/file/stat_spec.rb index 1ea003142e..d5238b6331 100644 --- a/spec/ruby/core/file/stat_spec.rb +++ b/spec/ruby/core/file/stat_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../shared/stat', __FILE__) +require_relative '../../spec_helper' +require_relative 'shared/stat' describe "File.stat" do it_behaves_like :file_stat, :stat @@ -23,14 +23,14 @@ platform_is_not :windows do st = f.stat - st.file?.should == true - st.zero?.should == false + st.should.file? + st.should_not.zero? st.size.should == 8 st.size?.should == 8 st.blksize.should >= 0 - st.atime.should be_kind_of(Time) - st.ctime.should be_kind_of(Time) - st.mtime.should be_kind_of(Time) + st.atime.should.is_a?(Time) + st.ctime.should.is_a?(Time) + st.mtime.should.is_a?(Time) end end @@ -38,8 +38,18 @@ platform_is_not :windows do File.symlink(@file, @link) st = File.stat(@link) - st.file?.should == true - st.symlink?.should == false + st.should.file? + st.should_not.symlink? + end + + it "returns an error when given missing non-ASCII path" do + missing_path = "/missingfilepath\xE3E4".b + -> { + File.stat(missing_path) + }.should.raise(SystemCallError) { |e| + [Errno::ENOENT, Errno::EILSEQ].should.include?(e.class) + e.message.should.include?(missing_path) + } end end end |
