FileUtils.mv accepts options. Closes #35.

This commit is contained in:
Greg Campbell 2010-07-02 13:25:45 -07:00 committed by Scott Taylor
parent 97a68c01ba
commit c2a9c13345
2 changed files with 7 additions and 1 deletions

View File

@ -86,7 +86,7 @@ module FakeFS
end
end
def mv(src, dest)
def mv(src, dest, options={})
if target = FileSystem.find(src)
FileSystem.add(dest, target.entry.clone)
FileSystem.delete(src)

View File

@ -688,6 +688,12 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal 'bar', File.open('baz') { |f| f.read }
end
def test_mv_works_with_options
File.open('foo', 'w') {|f| f.write 'bar'}
FileUtils.mv 'foo', 'baz', :force => true
assert_equal('bar', File.open('baz') { |f| f.read })
end
def test_cp_actually_works
File.open('foo', 'w') {|f| f.write 'bar' }
FileUtils.cp('foo', 'baz')