From 8414dd5cfd4c43c6c58f3ecadc1d6488eb136f76 Mon Sep 17 00:00:00 2001 From: Ben Atkins Date: Tue, 6 Nov 2012 11:34:02 -0500 Subject: [PATCH] Fixing the model tests to that they pass for the changes from #168, and updating the CHANGELOG. --- CHANGELOG.md | 2 ++ test/unit/model_test.rb | 16 ++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e99cc910..f523ac55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,5 +7,7 @@ if attribute value is changing. - [#173](https://github.com/airblade/paper_trail/pull/173) - Update link to [diff-lcs](https://github.com/halostatue/diff-lcs). - [#172](https://github.com/airblade/paper_trail/pull/172) - Save `object_changes` on creation. + - [#168](https://github.com/airblade/paper_trail/pull/168) - Respect conditional `:if` or `:unless` arguments to the + `has_paper_trail` method for `destroy` events. - [#167](https://github.com/airblade/paper_trail/pull/167) - Fix `originator` method so that it works with subclasses and STI. - [#160](https://github.com/airblade/paper_trail/pull/160) - Fixed failing tests and resolved out of date dependency issues. \ No newline at end of file diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 71ba26da..ce55433d 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -81,12 +81,8 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end context 'after destroy' do - setup do - @translation.save! - @translation.destroy - end - - should_not_change('the number of versions') { Version.count } + setup { @translation.destroy } + should 'not change the number of versions' do assert_equal(0, Version.count) end end end @@ -118,12 +114,8 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end context 'after destroy' do - setup do - @translation.save! - @translation.destroy - end - - should_change('the number of versions', :by => 1) { Version.count } + setup { @translation.destroy } + should 'change the number of versions' do assert_equal(2, Version.count) end end end end