default File.open to read mode
This commit is contained in:
parent
d9a44e5482
commit
35c88244de
@ -89,7 +89,7 @@ module FakeFS
|
||||
FileSystem.find(symlink.target).to_s
|
||||
end
|
||||
|
||||
def self.open(path, mode)
|
||||
def self.open(path, mode='r')
|
||||
if block_given?
|
||||
yield new(path, mode)
|
||||
else
|
||||
|
@ -188,4 +188,9 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
|
||||
assert_equal(['foo', 'foobar'], FileSystem.fs['path'].keys.sort)
|
||||
end
|
||||
|
||||
def test_file_open_defaults_to_read
|
||||
File.open('foo','w'){|f| f.write 'bar' }
|
||||
assert_equal 'bar', File.open('foo'){|f| f.read }
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user