diff options
author | Steve Klabnik + Katrina Owen <steve+katrina@steveklabnik.com> | 2012-12-21 22:38:52 +0000 |
---|---|---|
committer | Steve Klabnik + Katrina Owen <steve+katrina@steveklabnik.com> | 2012-12-21 23:49:43 +0000 |
commit | b02ebe73cf0d24139efbcb00b7c9eb6235794e58 (patch) | |
tree | 1b10465e582f68bbbdb73b5a484e9343d55ce436 /activesupport/test | |
parent | 3c2c1a46064684a1becc8ae7b6b7fe6eebf9651a (diff) | |
download | rails-b02ebe73cf0d24139efbcb00b7c9eb6235794e58.tar.gz rails-b02ebe73cf0d24139efbcb00b7c9eb6235794e58.tar.bz2 rails-b02ebe73cf0d24139efbcb00b7c9eb6235794e58.zip |
Refactor Hash.from_xml.
Three basic refactors in this PR:
* We extracted the logic into a method object. We now don't define a tone of extraneous methods on Hash, even if they were private.
* Extracted blocks of the case statement into methods that do the work. This makes the logic more clear.
* Extracted complicated if clauses into their own query methods. They often have two or three terms, this makes it much easier to see what they _do_.
We took care not to refactor too much as to not break anything, and put comments where we suspect tests are missing.
We think ActiveSupport::XMLMini might be a good candidate to move to a plugin in the future.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index c378dcd01d..5fc81ba6fc 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1330,7 +1330,7 @@ class HashToXmlTest < ActiveSupport::TestCase def test_empty_string_works_for_typecast_xml_value assert_nothing_raised do - Hash.__send__(:typecast_xml_value, "") + ActiveSupport::XMLConverter.new("").to_h end end |