From 25db1fc2014905d00795231dab2068f7a3497b04 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 4 Jan 2008 03:19:20 +0000 Subject: Ruby 1.9 compat: test multibyte chars proxy for 1.8 only git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8553 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 7ea21156f1..5f8f1537d9 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1229,19 +1229,21 @@ class BasicsTest < Test::Unit::TestCase topic = Topic.create('author_name' => author_name) assert_equal author_name, Topic.find(topic.id).author_name end - - def test_quote_chars - str = 'The Narrator' - topic = Topic.create(:author_name => str) - assert_equal str, topic.author_name - - assert_kind_of ActiveSupport::Multibyte::Chars, str.chars - topic = Topic.find_by_author_name(str.chars) - - assert_kind_of Topic, topic - assert_equal str, topic.author_name, "The right topic should have been found by name even with name passed as Chars" + + if RUBY_VERSION < '1.9' + def test_quote_chars + str = 'The Narrator' + topic = Topic.create(:author_name => str) + assert_equal str, topic.author_name + + assert_kind_of ActiveSupport::Multibyte::Chars, str.chars + topic = Topic.find_by_author_name(str.chars) + + assert_kind_of Topic, topic + assert_equal str, topic.author_name, "The right topic should have been found by name even with name passed as Chars" + end end - + def test_class_level_destroy should_be_destroyed_reply = Reply.create("title" => "hello", "content" => "world") Topic.find(1).replies << should_be_destroyed_reply -- cgit v1.2.3