From 801e314006ca755b94eccc6e7f80b1655168a250 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 28 Feb 2011 11:30:12 -0200 Subject: Add tests for register expansion methods with key = [] --- actionpack/test/template/asset_tag_helper_test.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index a1a6b5f1d0..f3f628f31b 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -302,11 +302,16 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n), javascript_include_tag(:can_merge) end - def test_custom_javascript_expansions_with_undefined_symbol + def test_custom_javascript_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => nil assert_raise(ArgumentError) { javascript_include_tag('first', :monkey, 'last') } end + def test_custom_javascript_expansions_with_empty_array_value + ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => [] + assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') + end + def test_custom_javascript_and_stylesheet_expansion_with_same_name ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"] @@ -379,11 +384,16 @@ class AssetTagHelperTest < ActionView::TestCase assert_dom_equal %(\n\n), stylesheet_link_tag('london', :cities) end - def test_custom_stylesheet_expansions_with_undefined_symbol + def test_custom_stylesheet_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => nil assert_raise(ArgumentError) { stylesheet_link_tag('first', :monkey, 'last') } end + def test_custom_stylesheet_expansions_with_empty_array_value + ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :monkey => [] + assert_dom_equal %(\n), stylesheet_link_tag('first', :monkey, 'last') + end + def test_registering_stylesheet_expansions_merges_with_existing_expansions ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :can_merge => ['bank'] -- cgit v1.2.3