aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorIlya Grigorik <ilya@igvita.com>2011-08-04 23:48:40 -0400
committerIlya Grigorik <ilya@igvita.com>2011-08-04 23:53:32 -0400
commited5c6d254c9ef5d44a11159561fddde7a3033874 (patch)
tree57009382e87c73bacc5a77929e5ceafd5605060a /actionpack/test/template
parente44efac0865a66b0546e32b4c6f23605a98a5845 (diff)
downloadrails-ed5c6d254c9ef5d44a11159561fddde7a3033874.tar.gz
rails-ed5c6d254c9ef5d44a11159561fddde7a3033874.tar.bz2
rails-ed5c6d254c9ef5d44a11159561fddde7a3033874.zip
generate environment dependent asset digests
If two different environments are configured to use the pipeline, but one has an extra step (such as compression) then without taking the environment into account you may end up serving wrong assets
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index f4b5344d63..dfa635335e 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -205,4 +205,17 @@ class SprocketsHelperTest < ActionView::TestCase
stubs(:asset_environment).returns(assets)
assert_match %r{/assets/style-[0-9a-f]+.css}, asset_path("style", "css")
end
+
+ test "alternate hash based on environment" do
+ assets = Sprockets::Environment.new
+ assets.version = 'development'
+ assets.append_path(FIXTURES.join("sprockets/alternate/stylesheets"))
+ stubs(:asset_environment).returns(assets)
+ dev_path = asset_path("style", "css")
+
+ assets.version = 'production'
+ prod_path = asset_path("style", "css")
+
+ assert_not_equal prod_path, dev_path
+ end
end