Merge pull request #1826 from gltarsa/flag-missing-partial
Ensure that misspelled or missing partials generate an error
This commit is contained in:
commit
260a9cd94c
|
@ -12,6 +12,11 @@ Feature: Provide Sane Defaults for Partial Behavior
|
|||
Then I should see "Header"
|
||||
And I should see "Footer"
|
||||
|
||||
Scenario: Flags error when partial is not found
|
||||
Given the Server is running at "partials-app"
|
||||
When I go to "/index_missing.html"
|
||||
Then I should see "Error: Could not locate partial"
|
||||
|
||||
Scenario: Prefers partials of the same engine type
|
||||
Given the Server is running at "partials-app"
|
||||
When I go to "/index.html"
|
||||
|
|
3
middleman-core/fixtures/partials-app/source/index_missing.html.erb
Executable file
3
middleman-core/fixtures/partials-app/source/index_missing.html.erb
Executable file
|
@ -0,0 +1,3 @@
|
|||
<%= partial "shared/header" %>
|
||||
<%= partial "i_do_not_exist" %>
|
||||
<%= partial "shared/footer" %>
|
|
@ -104,7 +104,6 @@ module Middleman
|
|||
|
||||
partial_file = locate_partial(name, false) || locate_partial(name, true)
|
||||
|
||||
return '' unless partial_file
|
||||
raise ::Middleman::TemplateRenderer::TemplateNotFound, "Could not locate partial: #{name}" unless partial_file
|
||||
|
||||
source_path = sitemap.file_to_path(partial_file)
|
||||
|
|
Loading…
Reference in a new issue