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 Aug 29, 2014
1 parent 541456a commit 37a155d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ PaperTrail::Rails::Engine.eager_load!
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.
- [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload `ActiveRecord` models in via a `Rails::Engine` when
the gem is used with `Rails`.

Expand Down
10 changes: 9 additions & 1 deletion spec/models/widget_spec.rb
Original file line number Diff line number Diff line change
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 37a155d

Please sign in to comment.