Skip to content

Commit

Permalink
close #354; fixes #374; close #131; Update CHANGELOG for PR for #375
Browse files Browse the repository at this point in the history
  • Loading branch information
batter committed Jul 30, 2014
1 parent 6de04f1 commit 071282f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@
new model instance.
- [#398](https://github.com/airblade/paper_trail/pull/398) - Only require the `RSpec` helper if `RSpec::Core` is required.
- [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher `have_a_version_with` for easier testing.
- [#375](https://github.com/airblade/paper_trail/pull/375) / [#374](https://github.com/airblade/paper_trail/issues/374) /
[#354](https://github.com/airblade/paper_trail/issues/354) / [#131](https://github.com/airblade/paper_trail/issues/131) -
Versions should be built with `after_` callbacks so the timestamp field for a version can be forced to match the
corresponding timestamp in the database for the state persistence of a change to the base (versioned) model.

## 3.0.3

Expand Down
10 changes: 9 additions & 1 deletion spec/models/widget_spec.rb
Expand Up @@ -48,6 +48,14 @@
end
end

describe :after_create do
let(:widget) { Widget.create!(:name => 'Foobar', :created_at => Time.now - 1.week) }

it "corresponding version should use the widget's `created_at`" do
widget.versions.last.created_at.to_i.should == widget.created_at.to_i
end
end

describe :after_update do
before { widget.update_attributes!(:name => 'Foobar', :updated_at => Time.now + 1.week) }

Expand All @@ -60,7 +68,7 @@
subject.should be_live
end

it "should use the widget updated_at" do
it "corresponding version should use the widget updated_at" do
widget.versions.last.created_at.to_i.should == widget.updated_at.to_i
end
end
Expand Down

0 comments on commit 071282f

Please sign in to comment.