Fix undefined variable error in cache_buster, and make its tests more explicit.
This commit is contained in:
parent
7e816c04c0
commit
0a97aa7ec3
|
@ -5,22 +5,23 @@ Feature: Generate mtime-based query string for busting browser caches
|
|||
Given "cache_buster" feature is "disabled"
|
||||
And the Server is running at "cache-buster-app"
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should not see "?"
|
||||
Then I should see "blank.gif'"
|
||||
|
||||
Scenario: Rendering html with the feature disabled
|
||||
Given "cache_buster" feature is "disabled"
|
||||
And the Server is running at "cache-buster-app"
|
||||
When I go to "/cache-buster.html"
|
||||
Then I should not see "?"
|
||||
Then I should see 'site.css"'
|
||||
|
||||
Scenario: Rendering css with the feature enabled
|
||||
Given "cache_buster" feature is "enabled"
|
||||
And the Server is running at "cache-buster-app"
|
||||
When I go to "/stylesheets/relative_assets.css"
|
||||
Then I should see "?"
|
||||
Then I should see "blank.gif?"
|
||||
|
||||
Scenario: Rendering html with the feature enabled
|
||||
Given "cache_buster" feature is "enabled"
|
||||
And the Server is running at "cache-buster-app"
|
||||
When I go to "/cache-buster.html"
|
||||
Then I should see "?"
|
||||
Then I should see "site.css?"
|
||||
Then I should see "blank.gif?"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
<%= stylesheet_link_tag "site.css" %>
|
||||
<%= javascript_include_tag "empty-with-include.js" %>
|
||||
<%= javascript_include_tag "empty-with-include.js" %>
|
||||
<%= image_tag "blank.gif" %>
|
||||
|
|
|
@ -54,7 +54,7 @@ module Middleman::Extensions
|
|||
elsif sitemap.exists?(real_path_static)
|
||||
page = sitemap.page(real_path_static)
|
||||
if !page.template?
|
||||
http_path << "?" + File.mtime(result[0]).strftime("%s")
|
||||
http_path << "?" + File.mtime(page.source_file).strftime("%s")
|
||||
else
|
||||
# It's a template, possible with partials. We can't really know when
|
||||
# it's updated, so generate fresh cache buster every time durin
|
||||
|
@ -71,4 +71,4 @@ module Middleman::Extensions
|
|||
|
||||
# Register the extension
|
||||
# register :cache_buster, CacheBuster
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue