Skip to content

Commit

Permalink
FileUtils.mv accepts options. Closes fakefs#35.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell authored and smtlaissezfaire committed Jul 3, 2010
1 parent 97a68c0 commit c2a9c13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fakefs/fileutils.rb
Expand Up @@ -86,7 +86,7 @@ def cp_r(src, dest)
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)
Expand Down
6 changes: 6 additions & 0 deletions test/fakefs_test.rb
Expand Up @@ -688,6 +688,12 @@ def test_mv_actually_works
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')
Expand Down

0 comments on commit c2a9c13

Please sign in to comment.