Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Entry#rename returns the renamed entry

  • Loading branch information...
commit 2b622ba94c86ede10253e0e319682d87c5a4e0e4 1 parent c27d16e
@adamwiggins authored
Showing with 5 additions and 0 deletions.
  1. +1 −0  lib/rush/entry.rb
  2. +4 −0 spec/entry_spec.rb
View
1  lib/rush/entry.rb
@@ -88,6 +88,7 @@ class NameCannotContainSlash < Exception; end
def rename(new_name)
connection.rename(@path, @name, new_name)
@name = new_name
+ self
end
# Rename an entry to another name within the same dir. The existing object
View
4 spec/entry_spec.rb
@@ -56,6 +56,10 @@
File.exists?("#{@sandbox_dir}/#{new_file}").should be_true
end
+ it "rename returns the renamed file" do
+ @entry.rename('file2').should == @entry.parent['file2']
+ end
+
it "can't rename itself if another file already exists with that name" do
new_file = "test3"
system "touch #{@sandbox_dir}/#{new_file}"
Please sign in to comment.
Something went wrong with that request. Please try again.