Skip to content

Commit

Permalink
index raises DoesNotExist when base path is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wiggins committed Mar 9, 2008
1 parent c1aeeb5 commit 96f69c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rush/local.rb
Expand Up @@ -99,6 +99,8 @@ def index(base_path, glob)
end
end
dirs.sort + files.sort
rescue Errno::ENOENT
raise Rush::DoesNotExist, base_path
end

# Fetch stats (size, ctime, etc) on an entry. Size will not be accurate for dirs.
Expand Down
4 changes: 4 additions & 0 deletions spec/local_spec.rb
Expand Up @@ -180,6 +180,10 @@
@con.index(@sandbox_dir, '*.rb').should == [ 'a.rb' ]
end

it "index raises DoesNotExist when the base path is invalid" do
lambda { @con.index('/does/not/exist', '*') }.should raise_error(Rush::DoesNotExist, '/does/not/exist')
end

it "stat gives file stats like size and timestamps" do
@con.stat(@sandbox_dir).should have_key(:ctime)
@con.stat(@sandbox_dir).should have_key(:size)
Expand Down

0 comments on commit 96f69c9

Please sign in to comment.