diff options
author | Sam Stephenson <sam@37signals.com> | 2005-12-27 03:11:03 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2005-12-27 03:11:03 +0000 |
commit | e567a5eb1afe1ac38f1da37f1c1e3922bbf79d2a (patch) | |
tree | 47baca37670f0ad23d803c2f939199147efe4287 /activesupport/test/core_ext | |
parent | 0b55ce7191b167d67ec7ccc7eb8db2e5fac4f2e1 (diff) | |
download | rails-e567a5eb1afe1ac38f1da37f1c1e3922bbf79d2a.tar.gz rails-e567a5eb1afe1ac38f1da37f1c1e3922bbf79d2a.tar.bz2 rails-e567a5eb1afe1ac38f1da37f1c1e3922bbf79d2a.zip |
Add ActiveSupport::JSON and Object#to_json for converting Ruby objects to JSON strings
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3356 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/object_and_class_ext_test.rb | 7 | ||||
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb index 25420b7f6f..22e4c6b8b4 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -104,4 +104,11 @@ class ObjectInstanceVariableTest < Test::Unit::TestCase assert !@dest.instance_variables.include?('@quux') assert_equal 'baz', @dest.instance_variable_get('@baz') end + + def test_instance_values + object = Object.new + object.instance_variable_set :@a, 1 + object.instance_variable_set :@b, 2 + assert_equal({'a' => 1, 'b' => 2}, object.instance_values) + end end diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 0e82badad7..92f57beb5f 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -89,4 +89,14 @@ class StringInflectionsTest < Test::Unit::TestCase assert s.ends_with?('lo') assert !s.ends_with?('el') end + + def test_each_char_with_utf8_string_when_kcode_is_utf8 + old_kcode, $KCODE = $KCODE, 'UTF8' + '€2.99'.each_char do |char| + assert_not_equal 1, char.length + break + end + ensure + $KCODE = old_kcode + end end |