aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index 7f629a91f4..152355c9dd 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -1623,7 +1623,7 @@ class BasicsTest < Test::Unit::TestCase
def test_to_param_should_return_string
assert_kind_of String, Client.find(:first).to_param
end
-
+
# FIXME: this test ought to run, but it needs to run sandboxed so that it
# doesn't b0rk the current test environment by undefing everything.
#
@@ -1646,6 +1646,19 @@ class BasicsTest < Test::Unit::TestCase
# "expected last count (#{counts.last}) to be <= first count (#{counts.first})"
#end
+ def test_inspect
+ topic = topics(:first)
+ assert_equal topic.inspect, '#<Topic id: 1, title: "The First Topic", author_name: "David", author_email_address: "david@loudthinking.com", written_on: "2003-07-16 07:28:11", bonus_time: "2000-01-01 06:28:00", last_read: "2004-04-15", content: "Have a nice day", approved: false, replies_count: 1, parent_id: nil, type: nil>'
+ end
+
+ def test_attribute_for_inspect
+ t = topics(:first)
+ t.content = %(This is some really long content, longer than 50 characters, so I can test that text is truncated correctly by the new ActiveRecord::Base#inspect method! Yay! BOOM!)
+
+ assert_equal t.attribute_for_inspect(:written_on), '"' + t.written_on.to_s(:db) + '"'
+ assert_equal t.attribute_for_inspect(:content), '"This is some really long content, longer than 50 ch..."'
+ end
+
private
def assert_readers(model, exceptions)
expected_readers = Set.new(model.column_names - ['id'])