Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise the error that includes an error message #472

Merged
merged 1 commit into from Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sprockets/rails/helper.rb
Expand Up @@ -369,7 +369,7 @@ def precompiled?(path)
end

def raise_unless_precompiled_asset(path)
raise Helper::AssetNotPrecompiled.new(path) if @check_precompiled_asset && !precompiled?(path)
raise Helper::AssetNotPrecompiledError.new(path) if @check_precompiled_asset && !precompiled?(path)
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_helper.rb
Expand Up @@ -880,12 +880,20 @@ def setup
@bundle_js_name = '/assets/bundle.js'
end

# both subclass and more specific error are supported due to
# https://github.com/rails/sprockets-rails/pull/414/commits/760a805a9f56d3df0d4b83bd4a5a6476eb3aeb29
def test_javascript_precompile
assert_raises(Sprockets::Rails::Helper::AssetNotPrecompiled) do
@view.javascript_include_tag("not_precompiled")
end
end

def test_javascript_precompile_thows_the_descriptive_error
assert_raises(Sprockets::Rails::Helper::AssetNotPrecompiledError) do
@view.javascript_include_tag("not_precompiled")
end
end

def test_stylesheet_precompile
assert_raises(Sprockets::Rails::Helper::AssetNotPrecompiled) do
@view.stylesheet_link_tag("not_precompiled")
Expand Down