aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJeremy Holland <jeremy@jeremypholland.com>2010-10-31 22:16:55 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-03 10:43:45 -0700
commitea0faa2055fbbe6ac9ebe960ddf4bea8adda287a (patch)
tree288788e1c0fdcbc744b856ae462aee95c8d6a5c6 /activesupport/test
parent208fb2920d6c6c6be97a7086cea24f4c8220010c (diff)
downloadrails-ea0faa2055fbbe6ac9ebe960ddf4bea8adda287a.tar.gz
rails-ea0faa2055fbbe6ac9ebe960ddf4bea8adda287a.tar.bz2
rails-ea0faa2055fbbe6ac9ebe960ddf4bea8adda287a.zip
Allowing to_xml :camelize option to be set to :lower to enable lower-camelcase tags [#5903 state:resolved]
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb9
-rw-r--r--activesupport/test/test_xml_mini.rb4
2 files changed, 10 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 545fed2684..cdf27ba35a 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -486,7 +486,7 @@ class HashExtToParamTests < Test::Unit::TestCase
def test_to_param_hash_escapes_its_keys_and_values
assert_equal 'param+1=A+string+with+%2F+characters+%26+that+should+be+%3F+escaped', { 'param 1' => 'A string with / characters & that should be ? escaped' }.to_param
end
-
+
def test_to_param_orders_by_key_in_ascending_order
assert_equal 'a=2&b=1&c=0', ActiveSupport::OrderedHash[*%w(b 1 c 0 a 2)].to_param
end
@@ -525,6 +525,13 @@ class HashToXmlTest < Test::Unit::TestCase
assert xml.include?(%(<Name>David</Name>))
end
+ def test_one_level_camelize_lower
+ xml = { :name => "David", :street_name => "Paulina" }.to_xml(@xml_options.merge(:camelize => :lower))
+ assert_equal "<person>", xml.first(8)
+ assert xml.include?(%(<streetName>Paulina</streetName>))
+ assert xml.include?(%(<name>David</name>))
+ end
+
def test_one_level_with_types
xml = { :name => "David", :street => "Paulina", :age => 26, :age_in_millis => 820497600000, :moved_on => Date.new(2005, 11, 15), :resident => :yes }.to_xml(@xml_options)
assert_equal "<person>", xml.first(8)
diff --git a/activesupport/test/test_xml_mini.rb b/activesupport/test/test_xml_mini.rb
index 585eb15c6e..b14a3e1546 100644
--- a/activesupport/test/test_xml_mini.rb
+++ b/activesupport/test/test_xml_mini.rb
@@ -18,8 +18,8 @@ class XmlMiniTest < Test::Unit::TestCase
assert_equal "MyKey", ActiveSupport::XmlMini.rename_key("my_key", :camelize => true)
end
- def test_rename_key_camelizes_with_camelize_true
- assert_equal "MyKey", ActiveSupport::XmlMini.rename_key("my_key", :camelize => true)
+ def test_rename_key_lower_camelizes_with_camelize_lower
+ assert_equal "myKey", ActiveSupport::XmlMini.rename_key("my_key", :camelize => :lower)
end
def test_rename_key_does_not_dasherize_leading_underscores