File#puts accepts (*args) and arrays
Signed-off-by: Chris Wanstrath <chris@ozmm.org>
This commit is contained in:
parent
ab81bbf8be
commit
e8257feadd
@ -103,8 +103,10 @@ module FakeFS
|
||||
@file
|
||||
end
|
||||
|
||||
def puts(content)
|
||||
write(content + "\n")
|
||||
def puts(*content)
|
||||
content.flatten.each do |obj|
|
||||
write(obj.to_s + "\n")
|
||||
end
|
||||
end
|
||||
|
||||
def write(content)
|
||||
|
@ -105,11 +105,11 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
def test_can_read_with_File_readlines
|
||||
path = '/path/to/file.txt'
|
||||
File.open(path, 'w') do |f|
|
||||
f.puts "Yatta!"
|
||||
f.puts "woot"
|
||||
f.puts "Yatta!", "Gatta!"
|
||||
f.puts ["woot","toot"]
|
||||
end
|
||||
|
||||
assert_equal ["Yatta!", "woot"], File.readlines(path)
|
||||
assert_equal %w(Yatta! Gatta! woot toot), File.readlines(path)
|
||||
end
|
||||
|
||||
def test_File_close_disallows_further_access
|
||||
|
Loading…
Reference in New Issue
Block a user