From 0613f3bcdbd077c3d961f274c390f39f1cd19a31 Mon Sep 17 00:00:00 2001 From: Sam Pohlenz Date: Fri, 1 Jul 2011 21:56:41 +0930 Subject: Add tests for alternate asset prefix/environment --- .../test/fixtures/sprockets/alternate/stylesheets/style.css | 1 + actionpack/test/template/sprockets_helper_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 actionpack/test/fixtures/sprockets/alternate/stylesheets/style.css diff --git a/actionpack/test/fixtures/sprockets/alternate/stylesheets/style.css b/actionpack/test/fixtures/sprockets/alternate/stylesheets/style.css new file mode 100644 index 0000000000..bfb90bfa48 --- /dev/null +++ b/actionpack/test/fixtures/sprockets/alternate/stylesheets/style.css @@ -0,0 +1 @@ +/* Different from other style.css */ \ No newline at end of file diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb index 6dc9a2a743..f11d1bba15 100644 --- a/actionpack/test/template/sprockets_helper_test.rb +++ b/actionpack/test/template/sprockets_helper_test.rb @@ -197,4 +197,16 @@ class SprocketsHelperTest < ActionView::TestCase assert_equal "\n", stylesheet_link_tag("style", "extra") end + + test "alternate asset prefix" do + stubs(:asset_prefix).returns("/themes/test") + assert_equal "/themes/test/style-d41d8cd98f00b204e9800998ecf8427e.css", asset_path("style", "css") + end + + test "alternate asset environment" do + assets = Sprockets::Environment.new + assets.paths << FIXTURES.join("sprockets/alternate/stylesheets") + stubs(:asset_environment).returns(assets) + assert_equal "/assets/style-df0b97ad35a8e1f7f61097461f77c19a.css", asset_path("style", "css") + end end -- cgit v1.2.3