diff options
Diffstat (limited to 'spec/ruby/core/file/shared')
| -rw-r--r-- | spec/ruby/core/file/shared/fnmatch.rb | 64 | ||||
| -rw-r--r-- | spec/ruby/core/file/shared/open.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/core/file/shared/path.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/core/file/shared/read.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/core/file/shared/stat.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/core/file/shared/unlink.rb | 4 |
6 files changed, 41 insertions, 41 deletions
diff --git a/spec/ruby/core/file/shared/fnmatch.rb b/spec/ruby/core/file/shared/fnmatch.rb index db4b5c5d8c..b9140d027d 100644 --- a/spec/ruby/core/file/shared/fnmatch.rb +++ b/spec/ruby/core/file/shared/fnmatch.rb @@ -222,48 +222,48 @@ describe :file_fnmatch, shared: true do it "returns false if '/' in pattern do not match '/' in path when flags includes FNM_PATHNAME" do pattern = '*/*' - File.send(@method, pattern, 'dave/.profile', File::FNM_PATHNAME).should be_false + File.send(@method, pattern, 'dave/.profile', File::FNM_PATHNAME).should == false pattern = '**/foo' - File.send(@method, pattern, 'a/.b/c/foo', File::FNM_PATHNAME).should be_false + File.send(@method, pattern, 'a/.b/c/foo', File::FNM_PATHNAME).should == false end it "returns true if '/' in pattern match '/' in path when flags includes FNM_PATHNAME" do pattern = '*/*' - File.send(@method, pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true + File.send(@method, pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true pattern = '**/foo' - File.send(@method, pattern, 'a/b/c/foo', File::FNM_PATHNAME).should be_true - File.send(@method, pattern, '/a/b/c/foo', File::FNM_PATHNAME).should be_true - File.send(@method, pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME).should be_true - File.send(@method, pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true + File.send(@method, pattern, 'a/b/c/foo', File::FNM_PATHNAME).should == true + File.send(@method, pattern, '/a/b/c/foo', File::FNM_PATHNAME).should == true + File.send(@method, pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME).should == true + File.send(@method, pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true end it "has special handling for ./ when using * and FNM_PATHNAME" do - File.send(@method, './*', '.', File::FNM_PATHNAME).should be_false - File.send(@method, './*', './', File::FNM_PATHNAME).should be_true - File.send(@method, './*/', './', File::FNM_PATHNAME).should be_false - File.send(@method, './**', './', File::FNM_PATHNAME).should be_true - File.send(@method, './**/', './', File::FNM_PATHNAME).should be_true - File.send(@method, './*', '.', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_false - File.send(@method, './*', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true - File.send(@method, './*/', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_false - File.send(@method, './**', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true - File.send(@method, './**/', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true + File.send(@method, './*', '.', File::FNM_PATHNAME).should == false + File.send(@method, './*', './', File::FNM_PATHNAME).should == true + File.send(@method, './*/', './', File::FNM_PATHNAME).should == false + File.send(@method, './**', './', File::FNM_PATHNAME).should == true + File.send(@method, './**/', './', File::FNM_PATHNAME).should == true + File.send(@method, './*', '.', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == false + File.send(@method, './*', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true + File.send(@method, './*/', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == false + File.send(@method, './**', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true + File.send(@method, './**/', './', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true end it "matches **/* with FNM_PATHNAME to recurse directories" do - File.send(@method, 'nested/**/*', 'nested/subdir', File::FNM_PATHNAME).should be_true - File.send(@method, 'nested/**/*', 'nested/subdir/file', File::FNM_PATHNAME).should be_true - File.send(@method, 'nested/**/*', 'nested/.dotsubdir', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true - File.send(@method, 'nested/**/*', 'nested/.dotsubir/.dotfile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true + File.send(@method, 'nested/**/*', 'nested/subdir', File::FNM_PATHNAME).should == true + File.send(@method, 'nested/**/*', 'nested/subdir/file', File::FNM_PATHNAME).should == true + File.send(@method, 'nested/**/*', 'nested/.dotsubdir', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true + File.send(@method, 'nested/**/*', 'nested/.dotsubir/.dotfile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true end it "matches ** with FNM_PATHNAME only in current directory" do - File.send(@method, 'nested/**', 'nested/subdir', File::FNM_PATHNAME).should be_true - File.send(@method, 'nested/**', 'nested/subdir/file', File::FNM_PATHNAME).should be_false - File.send(@method, 'nested/**', 'nested/.dotsubdir', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_true - File.send(@method, 'nested/**', 'nested/.dotsubir/.dotfile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should be_false + File.send(@method, 'nested/**', 'nested/subdir', File::FNM_PATHNAME).should == true + File.send(@method, 'nested/**', 'nested/subdir/file', File::FNM_PATHNAME).should == false + File.send(@method, 'nested/**', 'nested/.dotsubdir', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == true + File.send(@method, 'nested/**', 'nested/.dotsubir/.dotfile', File::FNM_PATHNAME | File::FNM_DOTMATCH).should == false end it "accepts an object that has a #to_path method" do @@ -271,21 +271,21 @@ describe :file_fnmatch, shared: true do end it "raises a TypeError if the first and second arguments are not string-like" do - -> { File.send(@method, nil, nil, 0, 0) }.should raise_error(ArgumentError) - -> { File.send(@method, 1, 'some/thing') }.should raise_error(TypeError) - -> { File.send(@method, 'some/thing', 1) }.should raise_error(TypeError) - -> { File.send(@method, 1, 1) }.should raise_error(TypeError) + -> { File.send(@method, nil, nil, 0, 0) }.should.raise(ArgumentError) + -> { File.send(@method, 1, 'some/thing') }.should.raise(TypeError) + -> { File.send(@method, 'some/thing', 1) }.should.raise(TypeError) + -> { File.send(@method, 1, 1) }.should.raise(TypeError) end it "raises a TypeError if the third argument is not an Integer" do - -> { File.send(@method, "*/place", "path/to/file", "flags") }.should raise_error(TypeError) - -> { File.send(@method, "*/place", "path/to/file", nil) }.should raise_error(TypeError) + -> { File.send(@method, "*/place", "path/to/file", "flags") }.should.raise(TypeError) + -> { File.send(@method, "*/place", "path/to/file", nil) }.should.raise(TypeError) end it "does not raise a TypeError if the third argument can be coerced to an Integer" do flags = mock("flags") flags.should_receive(:to_int).and_return(10) - -> { File.send(@method, "*/place", "path/to/file", flags) }.should_not raise_error + -> { File.send(@method, "*/place", "path/to/file", flags) }.should_not.raise end it "matches multibyte characters" do diff --git a/spec/ruby/core/file/shared/open.rb b/spec/ruby/core/file/shared/open.rb index 677a82a351..67149235ca 100644 --- a/spec/ruby/core/file/shared/open.rb +++ b/spec/ruby/core/file/shared/open.rb @@ -4,7 +4,7 @@ describe :open_directory, shared: true do it "opens directories" do file = File.send(@method, tmp("")) begin - file.should be_kind_of(File) + file.should.is_a?(File) ensure file.close end diff --git a/spec/ruby/core/file/shared/path.rb b/spec/ruby/core/file/shared/path.rb index 5a9fe1b0c5..6c6f7d4234 100644 --- a/spec/ruby/core/file/shared/path.rb +++ b/spec/ruby/core/file/shared/path.rb @@ -12,7 +12,7 @@ describe :file_path, shared: true do it "returns a String" do @file = File.new @path - @file.send(@method).should be_an_instance_of(String) + @file.send(@method).should.instance_of?(String) end it "returns a different String on every call" do diff --git a/spec/ruby/core/file/shared/read.rb b/spec/ruby/core/file/shared/read.rb index f232235298..f60800bb2f 100644 --- a/spec/ruby/core/file/shared/read.rb +++ b/spec/ruby/core/file/shared/read.rb @@ -3,13 +3,13 @@ require_relative '../../dir/fixtures/common' describe :file_read_directory, shared: true do platform_is :darwin, :linux, :freebsd, :openbsd, :windows do it "raises an Errno::EISDIR when passed a path that is a directory" do - -> { @object.send(@method, ".") }.should raise_error(Errno::EISDIR) + -> { @object.send(@method, ".") }.should.raise(Errno::EISDIR) end end platform_is :netbsd do it "does not raises any exception when passed a path that is a directory" do - -> { @object.send(@method, ".") }.should_not raise_error + -> { @object.send(@method, ".") }.should_not.raise end end end diff --git a/spec/ruby/core/file/shared/stat.rb b/spec/ruby/core/file/shared/stat.rb index fdaf97ea61..879a7f11ff 100644 --- a/spec/ruby/core/file/shared/stat.rb +++ b/spec/ruby/core/file/shared/stat.rb @@ -10,13 +10,13 @@ describe :file_stat, shared: true do it "returns a File::Stat object if the given file exists" do st = File.send(@method, @file) - st.should be_an_instance_of(File::Stat) + st.should.instance_of?(File::Stat) end it "returns a File::Stat object when called on an instance of File" do File.open(@file) do |f| st = f.send(@method) - st.should be_an_instance_of(File::Stat) + st.should.instance_of?(File::Stat) end end @@ -27,6 +27,6 @@ describe :file_stat, shared: true do it "raises an Errno::ENOENT if the file does not exist" do -> { File.send(@method, "fake_file") - }.should raise_error(Errno::ENOENT) + }.should.raise(Errno::ENOENT) end end diff --git a/spec/ruby/core/file/shared/unlink.rb b/spec/ruby/core/file/shared/unlink.rb index e339e93271..0032907ba2 100644 --- a/spec/ruby/core/file/shared/unlink.rb +++ b/spec/ruby/core/file/shared/unlink.rb @@ -31,11 +31,11 @@ describe :file_unlink, shared: true do end it "raises a TypeError if not passed a String type" do - -> { File.send(@method, 1) }.should raise_error(TypeError) + -> { File.send(@method, 1) }.should.raise(TypeError) end it "raises an Errno::ENOENT when the given file doesn't exist" do - -> { File.send(@method, 'bogus') }.should raise_error(Errno::ENOENT) + -> { File.send(@method, 'bogus') }.should.raise(Errno::ENOENT) end it "coerces a given parameter into a string if possible" do |
