require 'cases/helper' require 'models/person' require 'models/topic' class NonExistentTable < ActiveRecord::Base; end class CoreTest < ActiveRecord::TestCase fixtures :topics def test_inspect_class assert_equal 'ActiveRecord::Base', ActiveRecord::Base.inspect assert_equal 'LoosePerson(abstract)', LoosePerson.inspect assert_match(/^Topic\(id: integer, title: string/, Topic.inspect) end def test_inspect_instance topic = topics(:first) assert_equal %(#), topic.inspect end def test_inspect_new_instance assert_match(/Topic id: nil/, Topic.new.inspect) end def test_inspect_limited_select_instance assert_equal %(#), Topic.all.merge!(:select => 'id', :where => 'id = 1').first.inspect assert_equal %(#), Topic.all.merge!(:select => 'id, title', :where => 'id = 1').first.inspect end def test_inspect_class_without_table assert_equal "NonExistentTable(Table doesn't exist)", NonExistentTable.inspect end end