mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Replace inject with slightly more legible select
This commit is contained in:
parent
f46df7791f
commit
721d6ef33f
1 changed files with 3 additions and 4 deletions
|
@ -26,10 +26,9 @@ module Capybara
|
|||
|
||||
def rewrite_css_and_image_references(response_html) # :nodoc:
|
||||
return response_html unless Capybara.asset_root
|
||||
directories = Dir.new(Capybara.asset_root).entries.inject([]) do |list, name|
|
||||
list << name if File.directory?(name) and not name.to_s =~ /^\./
|
||||
list
|
||||
end
|
||||
directories = Dir.new(Capybara.asset_root).entries.select { |name|
|
||||
File.directory?(name) and not name.to_s =~ /^\./
|
||||
}
|
||||
response_html.gsub(/=("|')\/(#{directories.join('|')})/, '=\1' + Capybara.asset_root.to_s + '/\2')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue