提交 64986955 编写于 作者: J Jon Leighton

Fixtures support for ActiveRecord::Model

上级 ba7ec73f
......@@ -559,7 +559,7 @@ def table_rows
rows[table_name] = fixtures.map do |label, fixture|
row = fixture.to_hash
if model_class && model_class < ActiveRecord::Base
if model_class && model_class < ActiveRecord::Model
# fill in timestamp columns if they aren't specified and the model is set to record_timestamps
if model_class.record_timestamps
timestamp_column_names.each do |name|
......
......@@ -51,3 +51,15 @@ def test_mirrored_configuration
ActiveRecord::Base.time_zone_aware_attributes = false
end
end
class InclusionFixturesTest < ActiveRecord::TestCase
fixtures :teapots
def test_fixtured_record
assert_equal "Bob", teapots(:bob).name
end
def test_timestamped_fixture
assert_not_nil teapots(:bob).created_at
end
end
......@@ -598,6 +598,7 @@ def create_table(*args, &block)
create_table :teapots, :force => true do |t|
t.string :name
t.timestamps
end
create_table :topics, :force => true do |t|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册