1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

Changed NotOnUpdate test to use record.versions.last.changeset

This commit is contained in:
denisahearn 2022-02-01 08:40:46 -06:00
parent 643e4747ee
commit 12976d5489
2 changed files with 2 additions and 5 deletions

View file

@ -50,7 +50,6 @@ Security/YAMLLoad:
- 'spec/models/book_spec.rb'
- 'spec/models/gadget_spec.rb'
- 'spec/models/no_object_spec.rb'
- 'spec/models/not_on_update_spec.rb'
- 'spec/models/person_spec.rb'
- 'spec/models/version_spec.rb'
- 'spec/paper_trail/events/destroy_spec.rb'

View file

@ -15,10 +15,8 @@ RSpec.describe NotOnUpdate, type: :model do
it "captures changes when in_after_callback is true" do
record.name = "test"
record.paper_trail.save_with_version(in_after_callback: true)
as_stored_in_version = HashWithIndifferentAccess[
YAML.load(record.versions.last.object_changes)
]
expect(as_stored_in_version[:name].last).to(eq("test"))
changeset = record.versions.last.changeset
expect(changeset[:name]).to eq([nil, "test"])
end
end
end