FileUtils.mv accepts options. Closes #35.
This commit is contained in:
parent
97a68c01ba
commit
c2a9c13345
@ -86,7 +86,7 @@ module FakeFS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mv(src, dest)
|
def mv(src, dest, options={})
|
||||||
if target = FileSystem.find(src)
|
if target = FileSystem.find(src)
|
||||||
FileSystem.add(dest, target.entry.clone)
|
FileSystem.add(dest, target.entry.clone)
|
||||||
FileSystem.delete(src)
|
FileSystem.delete(src)
|
||||||
|
@ -688,6 +688,12 @@ class FakeFSTest < Test::Unit::TestCase
|
|||||||
assert_equal 'bar', File.open('baz') { |f| f.read }
|
assert_equal 'bar', File.open('baz') { |f| f.read }
|
||||||
end
|
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
|
def test_cp_actually_works
|
||||||
File.open('foo', 'w') {|f| f.write 'bar' }
|
File.open('foo', 'w') {|f| f.write 'bar' }
|
||||||
FileUtils.cp('foo', 'baz')
|
FileUtils.cp('foo', 'baz')
|
||||||
|
Loading…
Reference in New Issue
Block a user