Skip to content

Commit

Permalink
Merge remote-tracking branch 'PierreRambaud/master'
Browse files Browse the repository at this point in the history
* PierreRambaud/master:
  Add sticky? method for File::Stat

Conflicts:
	test/file/stat_test.rb
	test/kernel_test.rb
  • Loading branch information
eventualbuddha committed Sep 30, 2014
2 parents b81acc4 + 3889646 commit 349609e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fakefs/file.rb
Expand Up @@ -307,7 +307,7 @@ def ftype
'file'
end

# assumes, like above, that all files are readable and writable
# assumes, like above, that all files are readable, writable and sticky
def readable?
true
end
Expand All @@ -316,6 +316,10 @@ def writable?
true
end

def sticky?
true
end

# World_writable and readable are platform dependent
# usually comparing with S_IROTH defined on compilation (MRI)
def world_writable?
Expand Down
5 changes: 5 additions & 0 deletions test/file/stat_test.rb
Expand Up @@ -122,6 +122,11 @@ def test_responds_to_world_writable
assert File::Stat.new('/foo').world_writable? == 0777
end

def test_responds_to_sticky
FileUtils.touch("/foo")
assert File::Stat.new("/foo").sticky? == true
end

def test_responds_to_world_readable
FileUtils.touch('/foo')
assert File::Stat.new('/foo').world_readable? == 0777, "#{File::Stat.new('/foo').world_readable?}"
Expand Down

0 comments on commit 349609e

Please sign in to comment.