1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Added test for case without object_changes column

This commit is contained in:
Edward Tsech 2011-07-13 11:29:30 +07:00
parent e3890af1a6
commit b229927c2b
2 changed files with 14 additions and 0 deletions

View file

@ -47,3 +47,11 @@ def change_schema
end
ActiveRecord::Migration.verbose = true
end
def remove_object_changes_column
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
remove_column :versions, :object_changes
end
ActiveRecord::Migration.verbose = true
end

View file

@ -102,6 +102,12 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
assert_equal ({'name' => ['Henry', 'Harry']}), @widget.versions.last.changeset
end
should 'return nil after call changeset method if object_changes column doesn\'t exist' do
remove_object_changes_column
Version.reset_column_information
assert_nil @widget.versions.last.changeset
end
if defined?(ActiveRecord::IdentityMap) && ActiveRecord::IdentityMap.respond_to?(:without)
should 'not clobber the IdentityMap when reifying' do
module ActiveRecord::IdentityMap