Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

File.read accepts multiple parameters.

  • Loading branch information...
commit 58857bf9379caa8a687ed3de482faa3f444ffa8f 1 parent 98e108b
@ToadJamb ToadJamb authored
Showing with 10 additions and 1 deletion.
  1. +1 −1  lib/fakefs/file.rb
  2. +9 −0 test/fakefs_test.rb
View
2  lib/fakefs/file.rb
@@ -149,7 +149,7 @@ def self.readlink(path)
symlink.target
end
- def self.read(path)
+ def self.read(path, *args)
file = new(path)
if file.exists?
FileSystem.find(path).atime = Time.now
View
9 test/fakefs_test.rb
@@ -412,6 +412,15 @@ def test_can_read_files_once_written
assert_equal "Yatta!", File.read(path)
end
+ def test_file_read_accepts_hashes
+ path = 'file.txt'
+ File.open(path, 'w') do |f|
+ f.write 'Yatta!'
+ end
+
+ assert_nothing_raised { File.read(path, :mode => 'r:UTF-8:-') }
+ end
+
def test_can_write_to_files
path = 'file.txt'
File.open(path, 'w') do |f|
Please sign in to comment.
Something went wrong with that request. Please try again.