Skip to content

Commit

Permalink
Fix string comarison with pathname error (rails#72)
Browse files Browse the repository at this point in the history
* Fix comparison with pathname issue

* Map to string on the array

* Ensure one of the paths for test is a string

Co-authored-by: David Heinemeier Hansson <[email protected]>
Co-authored-by: David Heinemeier Hansson <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2022
1 parent f953dce commit 7f724d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/propshaft/load_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def clear_cache

def dedup(paths)
[].tap do |deduped|
Array(paths).sort.each do |path|
deduped << Pathname.new(path) if deduped.blank? || !path.to_s.start_with?(deduped.last.to_s)
Array(paths).map(&:to_s).sort.each do |path|
deduped << Pathname.new(path) if deduped.blank? || !path.start_with?(deduped.last.to_s)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/propshaft/load_path_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Propshaft::LoadPathTest < ActiveSupport::TestCase
setup do
@load_path = Propshaft::LoadPath.new [
Pathname.new("#{__dir__}/../fixtures/assets/first_path"),
Pathname.new("#{__dir__}/../fixtures/assets/second_path")
Pathname.new("#{__dir__}/../fixtures/assets/second_path").to_s
]
end

Expand Down

0 comments on commit 7f724d1

Please sign in to comment.