summaryrefslogtreecommitdiff
path: root/spec/ruby/core/file/chown_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/file/chown_spec.rb')
-rw-r--r--spec/ruby/core/file/chown_spec.rb46
1 files changed, 19 insertions, 27 deletions
diff --git a/spec/ruby/core/file/chown_spec.rb b/spec/ruby/core/file/chown_spec.rb
index a0b46e9e39..3353aafc70 100644
--- a/spec/ruby/core/file/chown_spec.rb
+++ b/spec/ruby/core/file/chown_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
describe "File.chown" do
before :each do
@@ -66,9 +66,9 @@ describe "File.chown" do
platform_is_not :windows do
it "raises an error for a non existent path" do
- lambda {
+ -> {
File.chown(nil, nil, "#{@fname}_not_existing")
- }.should raise_error(Errno::ENOENT)
+ }.should.raise(Errno::ENOENT)
end
end
@@ -78,30 +78,30 @@ describe "File.chown" do
end
describe "File#chown" do
- before :each do
- @fname = tmp('file_chown_test')
- @file = File.open(@fname, 'w')
- end
+ before :each do
+ @fname = tmp('file_chown_test')
+ @file = File.open(@fname, 'w')
+ end
- after :each do
- @file.close unless @file.closed?
- rm_r @fname
- end
+ after :each do
+ @file.close unless @file.closed?
+ rm_r @fname
+ end
as_superuser do
platform_is :windows do
it "does not modify the owner id of the file" do
- File.chown 0, nil, @fname
- File.stat(@fname).uid.should == 0
- File.chown 501, nil, @fname
- File.stat(@fname).uid.should == 0
+ @file.chown 0, nil
+ @file.stat.uid.should == 0
+ @file.chown 501, nil
+ @file.stat.uid.should == 0
end
it "does not modify the group id of the file" do
- File.chown nil, 0, @fname
- File.stat(@fname).gid.should == 0
- File.chown nil, 501, @fname
- File.stat(@fname).gid.should == 0
+ @file.chown nil, 0
+ @file.stat.gid.should == 0
+ @file.chown nil, 501
+ @file.stat.gid.should == 0
end
end
@@ -142,11 +142,3 @@ describe "File#chown" do
@file.chown(nil, nil).should == 0
end
end
-
-describe "File.chown" do
- it "needs to be reviewed for spec completeness"
-end
-
-describe "File#chown" do
- it "needs to be reviewed for spec completeness"
-end