Skip to content

Commit

Permalink
Merge pull request #1200 from Earlopain/pathname-glob-missing-folder
Browse files Browse the repository at this point in the history
Add spec for `Pathname{#,.}glob` with missing directory
  • Loading branch information
andrykonchin authored Oct 5, 2024
2 parents 4b074c7 + ce4b03d commit 130f029
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/pathname/glob_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
Pathname.glob(@dir + 'lib/*.js').should == []
end

it 'returns [] when the pathname does not exist' do
Pathname.glob('i_dont_exist/lib/*.js').should == []
end

it 'returns matching file paths' do
Pathname.glob(@dir + 'lib/*i*.rb').sort.should == [Pathname.new(@file_1), Pathname.new(@file_2)].sort
end
Expand Down Expand Up @@ -67,6 +71,10 @@
Pathname.new(@dir).glob('lib/*.js').should == []
end

it 'returns [] when the pathname does not exist' do
Pathname.new('./i_dont_exist').glob('lib/*.js').should == []
end

it 'returns matching file paths' do
Pathname.new(@dir).glob('lib/*i*.rb').sort.should == [Pathname.new(@file_1), Pathname.new(@file_2)].sort
end
Expand Down

0 comments on commit 130f029

Please sign in to comment.