diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-08-18 14:59:27 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-08-18 15:35:41 -0500 |
commit | 7223f10acda3d5683e6de817bc7131ca109f3f28 (patch) | |
tree | 37181978cbf1a1ba4dbb3686a9b1dea82fbc2aa2 /actionpack/test/template | |
parent | cc90adfd2a171c5fc9f90f6a6506c5ac937efab3 (diff) | |
download | rails-7223f10acda3d5683e6de817bc7131ca109f3f28.tar.gz rails-7223f10acda3d5683e6de817bc7131ca109f3f28.tar.bz2 rails-7223f10acda3d5683e6de817bc7131ca109f3f28.zip |
Debug assets by default in development and test environments
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/sprockets_helper_test.rb | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb index dfa635335e..d303acad0f 100644 --- a/actionpack/test/template/sprockets_helper_test.rb +++ b/actionpack/test/template/sprockets_helper_test.rb @@ -141,6 +141,8 @@ class SprocketsHelperTest < ActionView::TestCase end test "javascript include tag" do + Rails.env.stubs(:test?).returns(false) + assert_match %r{<script src="/assets/application-[0-9a-f]+.js" type="text/javascript"></script>}, javascript_include_tag(:application) @@ -151,11 +153,17 @@ class SprocketsHelperTest < ActionView::TestCase assert_equal '<script src="http://www.example.com/xmlhr" type="text/javascript"></script>', javascript_include_tag("http://www.example.com/xmlhr") + assert_match %r{<script src=\"/assets/xmlhr-[0-9a-f]+.js" type=\"text/javascript\"></script>\n<script src=\"/assets/extra-[0-9a-f]+.js" type=\"text/javascript\"></script>}, + javascript_include_tag("xmlhr", "extra") + + Rails.env.stubs(:test?).returns(true) + assert_match %r{<script src="/assets/xmlhr-[0-9a-f]+.js\?body=1" type="text/javascript"></script>\n<script src="/assets/application-[0-9a-f]+.js\?body=1" type="text/javascript"></script>}, - javascript_include_tag(:application, :debug => true) + javascript_include_tag(:application) + + assert_match %r{<script src="/assets/application-[0-9a-f]+.js\" type="text/javascript"></script>}, + javascript_include_tag(:application, :debug => false) - assert_match %r{<script src=\"/assets/xmlhr-[0-9a-f]+.js\" type=\"text/javascript\"></script>\n<script src=\"/assets/extra-[0-9a-f]+.js\" type=\"text/javascript\"></script>}, - javascript_include_tag("xmlhr", "extra") end test "stylesheet path" do @@ -172,6 +180,8 @@ class SprocketsHelperTest < ActionView::TestCase end test "stylesheet link tag" do + Rails.env.stubs(:test?).returns(false) + assert_match %r{<link href="/assets/application-[0-9a-f]+.css" media="screen" rel="stylesheet" type="text/css" />}, stylesheet_link_tag(:application) @@ -187,11 +197,17 @@ class SprocketsHelperTest < ActionView::TestCase assert_match %r{<link href="/assets/style-[0-9a-f]+.css" media="print" rel="stylesheet" type="text/css" />}, stylesheet_link_tag("style", :media => "print") - assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />}, - stylesheet_link_tag(:application, :debug => true) - assert_match %r{<link href="/assets/style-[0-9a-f]+.css" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/extra-[0-9a-f]+.css" media="screen" rel="stylesheet" type="text/css" />}, stylesheet_link_tag("style", "extra") + + Rails.env.stubs(:test?).returns(true) + + assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />}, + stylesheet_link_tag(:application) + + assert_match %r{<link href="/assets/application-[0-9a-f]+.css" media="screen" rel="stylesheet" type="text/css" />}, + stylesheet_link_tag(:application, :debug => false) + end test "alternate asset prefix" do |