diff --git a/middleman-more/features/asset_hash.feature b/middleman-more/features/asset_hash.feature index 47e77a5d..ec4938be 100644 --- a/middleman-more/features/asset_hash.feature +++ b/middleman-more/features/asset_hash.feature @@ -8,7 +8,7 @@ Feature: Assets get a file hash appended to their and references to them are upd | images/100px-5fd6fb90.jpg | | images/100px-5fd6fb90.gif | | javascripts/application-1d8d5276.js | - | stylesheets/site-92072d15.css | + | stylesheets/site-8c28fde3.css | | index.html | | subdir/index.html | | other/index.html | @@ -20,35 +20,47 @@ Feature: Assets get a file hash appended to their and references to them are upd | stylesheets/site.css | And the file "javascripts/application-1d8d5276.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'" - # TODO: This stylesheet should use the SASS "image-url" helper but can't because of https://github.com/middleman/middleman/issues/283 - And the file "stylesheets/site-92072d15.css" should contain 'background-image: url("/images/100px-5fd6fb90.jpg")' - And the file "index.html" should contain 'href="stylesheets/site-92072d15.css"' + And the file "stylesheets/site-8c28fde3.css" should contain "background-image: url('../images/100px-5fd6fb90.jpg')" + And the file "index.html" should contain 'href="stylesheets/site-8c28fde3.css"' And the file "index.html" should contain 'src="javascripts/application-1d8d5276.js"' And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"' - And the file "subdir/index.html" should contain 'href="../stylesheets/site-92072d15.css"' + And the file "subdir/index.html" should contain 'href="../stylesheets/site-8c28fde3.css"' And the file "subdir/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' - And the file "other/index.html" should contain 'href="../stylesheets/site-92072d15.css"' + And the file "other/index.html" should contain 'href="../stylesheets/site-8c28fde3.css"' And the file "other/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' Scenario: Hashed assets work in preview server Given the Server is running at "asset-hash-app" When I go to "/" - Then I should see 'href="stylesheets/site-92072d15.css"' + Then I should see 'href="stylesheets/site-8c28fde3.css"' And I should see 'src="javascripts/application-1d8d5276.js"' And I should see 'src="images/100px-5fd6fb90.jpg"' When I go to "/subdir/" - Then I should see 'href="../stylesheets/site-92072d15.css"' + Then I should see 'href="../stylesheets/site-8c28fde3.css"' And I should see 'src="../javascripts/application-1d8d5276.js"' And I should see 'src="../images/100px-5fd6fb90.jpg"' When I go to "/other/" - Then I should see 'href="../stylesheets/site-92072d15.css"' + Then I should see 'href="../stylesheets/site-8c28fde3.css"' And I should see 'src="../javascripts/application-1d8d5276.js"' And I should see 'src="../images/100px-5fd6fb90.jpg"' When I go to "/javascripts/application-1d8d5276.js" Then I should see "img.src = '/images/100px-5fd6fb90.jpg'" - When I go to "/stylesheets/site-92072d15.css" - Then I should see 'background-image: url("/images/100px-5fd6fb90.jpg")' + When I go to "/stylesheets/site-8c28fde3.css" + Then I should see "background-image: url('../images/100px-5fd6fb90.jpg')" - # Scenario: Enabling an asset host still produces hashed files and references + Scenario: Enabling an asset host still produces hashed files and references + Given the Server is running at "asset-hash-host-app" + When I go to "/" + Then I should see 'href="http://middlemanapp.com/stylesheets/site-8c28fde3.css"' + And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' + When I go to "/subdir/" + Then I should see 'href="http://middlemanapp.com/stylesheets/site-8c28fde3.css"' + And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' + When I go to "/other/" + Then I should see 'href="http://middlemanapp.com/stylesheets/site-8c28fde3.css"' + And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' + # Asset helpers don't appear to work from Compass right now + # When I go to "/stylesheets/site-8c28fde3.css" + # Then I should see "background-image: url('http://middlemanapp.com/images/100px-5fd6fb90.jpg')" \ No newline at end of file diff --git a/middleman-more/fixtures/asset-hash-app/source/stylesheets/site.css.scss b/middleman-more/fixtures/asset-hash-app/source/stylesheets/site.css.scss index 51811bfe..0d193a5c 100644 --- a/middleman-more/fixtures/asset-hash-app/source/stylesheets/site.css.scss +++ b/middleman-more/fixtures/asset-hash-app/source/stylesheets/site.css.scss @@ -1,6 +1,4 @@ #main { padding: 50px; - // Can't use image-url until compass problem is fixed: https://github.com/middleman/middleman/issues/283 - // background-image: image-url('100px.jpg'); - background-image: url('/images/100px.jpg'); + background-image: image-url('100px.jpg'); } \ No newline at end of file diff --git a/middleman-more/fixtures/asset-hash-host-app/config.rb b/middleman-more/fixtures/asset-hash-host-app/config.rb new file mode 100644 index 00000000..f40e1c63 --- /dev/null +++ b/middleman-more/fixtures/asset-hash-host-app/config.rb @@ -0,0 +1,6 @@ + +activate :asset_hash +activate :directory_indexes +activate :asset_host + +set :asset_host, 'http://middlemanapp.com' diff --git a/middleman-more/fixtures/asset-hash-host-app/source/images/100px.gif b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.gif new file mode 100644 index 00000000..557d0278 Binary files /dev/null and b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.gif differ diff --git a/middleman-more/fixtures/asset-hash-host-app/source/images/100px.jpg b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.jpg new file mode 100644 index 00000000..557d0278 Binary files /dev/null and b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.jpg differ diff --git a/middleman-more/fixtures/asset-hash-host-app/source/images/100px.png b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.png new file mode 100644 index 00000000..a78f68b8 Binary files /dev/null and b/middleman-more/fixtures/asset-hash-host-app/source/images/100px.png differ diff --git a/middleman-more/fixtures/asset-hash-host-app/source/index.html.erb b/middleman-more/fixtures/asset-hash-host-app/source/index.html.erb new file mode 100644 index 00000000..3616ba64 --- /dev/null +++ b/middleman-more/fixtures/asset-hash-host-app/source/index.html.erb @@ -0,0 +1,6 @@ +<% content_for :head do %> +