diff --git a/middleman-core/features/partials.feature b/middleman-core/features/partials.feature index 30773b46..8a0154c2 100644 --- a/middleman-core/features/partials.feature +++ b/middleman-core/features/partials.feature @@ -5,25 +5,30 @@ Feature: Provide Sane Defaults for Partial Behavior When I go to "/index.html" Then I should see "Header" And I should see "Footer" - + Scenario: Finds shared partials relative to the root (sub) Given the Server is running at "partials-app" When I go to "/sub/index.html" 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" Then I should see "ERb Main" - + Scenario: Prefers partials of the same engine type Given the Server is running at "partials-app" When I go to "/second.html" Then I should see "Str Main" And I should see "Header" And I should see "Footer" - + Scenario: Finds partial relative to template Given the Server is running at "partials-app" When I go to "/sub/index.html" @@ -33,7 +38,7 @@ Feature: Provide Sane Defaults for Partial Behavior Given the Server is running at "partials-app" When I go to "/locals.html" Then I should see "Local var is bar" - + Scenario: Partial and Layout use different engines Given the Server is running at "different-engine-partial" When I go to "/index.html" diff --git a/middleman-core/fixtures/partials-app/source/index_missing.html.erb b/middleman-core/fixtures/partials-app/source/index_missing.html.erb new file mode 100755 index 00000000..bcd70b82 --- /dev/null +++ b/middleman-core/fixtures/partials-app/source/index_missing.html.erb @@ -0,0 +1,3 @@ +<%= partial "shared/header" %> +<%= partial "i_do_not_exist" %> +<%= partial "shared/footer" %> diff --git a/middleman-core/lib/middleman-core/template_context.rb b/middleman-core/lib/middleman-core/template_context.rb index cd0b50e8..4feca57e 100644 --- a/middleman-core/lib/middleman-core/template_context.rb +++ b/middleman-core/lib/middleman-core/template_context.rb @@ -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)