diff --git a/lib/sprockets/base.rb b/lib/sprockets/base.rb index 719d6f51e..2060eb364 100644 --- a/lib/sprockets/base.rb +++ b/lib/sprockets/base.rb @@ -75,8 +75,8 @@ def file_digest(path) end # Find asset by logical path or expanded path. - def find_asset(*args) - uri, _ = resolve(*args) + def find_asset(*args, **options) + uri, _ = resolve(*args, **options) if uri load(uri) end diff --git a/lib/sprockets/environment.rb b/lib/sprockets/environment.rb index 11840dcff..5d73ae5aa 100644 --- a/lib/sprockets/environment.rb +++ b/lib/sprockets/environment.rb @@ -27,8 +27,8 @@ def cached end alias_method :index, :cached - def find_asset(*args) - cached.find_asset(*args) + def find_asset(*args, **options) + cached.find_asset(*args, **options) end def find_asset!(*args) diff --git a/test/test_asset.rb b/test/test_asset.rb index c70b0ed91..8e5c3ac82 100644 --- a/test/test_asset.rb +++ b/test/test_asset.rb @@ -332,7 +332,7 @@ def setup end def asset(logical_path, options = {}) - @env.find_asset(logical_path, {pipeline: @pipeline}.merge(options)) + @env.find_asset(logical_path, **{pipeline: @pipeline}.merge(options)) end end @@ -403,7 +403,7 @@ def setup end def asset(logical_path, options = {}) - @env.find_asset(logical_path, {pipeline: @pipeline}.merge(options)) + @env.find_asset(logical_path, **{pipeline: @pipeline}.merge(options)) end end @@ -1110,7 +1110,7 @@ def setup end def asset(logical_path, options = {}) - @env.find_asset(logical_path, {pipeline: @pipeline}.merge(options)) + @env.find_asset(logical_path, **{pipeline: @pipeline}.merge(options)) end def read(logical_path) @@ -1245,7 +1245,7 @@ def logical_path(path, options = {}) filename = fixture_path("paths/#{path}") assert File.exist?(filename), "#{filename} does not exist" silence_warnings do - assert asset = @env.find_asset(filename, options), "couldn't find asset: #{filename}" + assert asset = @env.find_asset(filename, **options), "couldn't find asset: #{filename}" asset.logical_path end end @@ -1308,7 +1308,7 @@ def content_type(path, options = {}) filename = fixture_path("paths/#{path}") assert File.exist?(filename), "#{filename} does not exist" silence_warnings do - assert asset = @env.find_asset(filename, options), "couldn't find asset: #{filename}" + assert asset = @env.find_asset(filename, **options), "couldn't find asset: #{filename}" asset.content_type end end diff --git a/test/test_resolve.rb b/test/test_resolve.rb index 1144e7ba7..7f98f37c9 100644 --- a/test/test_resolve.rb +++ b/test/test_resolve.rb @@ -255,15 +255,15 @@ def setup @env.append_path(random_path) error = assert_raises(Sprockets::FileNotFound) do - uri, _ = @env.resolve!("thisfiledoesnotexistandshouldraiseerrors", {}) + uri, _ = @env.resolve!("thisfiledoesnotexistandshouldraiseerrors", **{}) uri end assert_match(/#{ random_path }/, error.message) end - def resolve(path, options = {}) - uri, _ = @env.resolve(path, options) + def resolve(path, **options) + uri, _ = @env.resolve(path, **options) uri end end