Add separate test for :ignore attribute.

This commit is contained in:
Edward Tsech 2011-11-09 11:32:57 +01:00 committed by Andy Stewart
parent 3e26b4453b
commit df4eaab360
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,4 @@
class LegacyWidget < ActiveRecord::Base
has_paper_trail :version_name => 'custom_version'
has_paper_trail :ignore => :version,
:version_name => 'custom_version'
end

View File

@ -2,7 +2,7 @@ require 'test_helper'
class HasPaperTrailModelTest < ActiveSupport::TestCase
context 'A record' do
context 'A record with defined "only" and "ignore" attributes' do
setup { @article = Article.create }
context 'which updates an ignored column' do
@ -57,7 +57,15 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
end
end
end
end
context 'A record with defined "ignore" attribute' do
setup { @legacy_widget = LegacyWidget.create }
context 'which updates an ignored column' do
setup { @legacy_widget.update_attributes :version => 1 }
should_not_change('the number of versions') { Version.count }
end
end