close #354; fixes #374; close #131; Update CHANGELOG for PR for #375

This commit is contained in:
Ben Atkins 2014-07-30 16:17:02 -04:00
parent 6de04f199e
commit 071282f303
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -48,6 +48,14 @@ describe Widget do
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) }
@ -60,7 +68,7 @@ describe Widget do
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