Merge pull request #7550 from openfoodfoundation/dependabot/bundler/paper_trail-12.0.0

Bump paper_trail from 10.3.1 to 12.0.0
This commit is contained in:
Andy Brett
2021-07-02 10:14:53 -07:00
committed by GitHub
3 changed files with 49 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ gem 'geocoder'
gem 'gmaps4rails'
gem 'mimemagic', '> 0.3.5'
gem 'paperclip', '~> 3.4.1'
gem 'paper_trail', '~> 10.3.1'
gem 'paper_trail', '~> 12.0.0'
gem 'rack-rewrite'
gem 'rack-ssl', require: 'rack/ssl'
gem 'roadie-rails'

View File

@@ -403,8 +403,8 @@ GEM
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
orm_adapter (0.5.0)
paper_trail (10.3.1)
activerecord (>= 4.2)
paper_trail (12.0.0)
activerecord (>= 5.2)
request_store (~> 1.1)
paperclip (3.4.2)
activemodel (>= 3.0.0)
@@ -758,7 +758,7 @@ DEPENDENCIES
oauth2 (~> 1.4.7)
ofn-qz!
order_management!
paper_trail (~> 10.3.1)
paper_trail (~> 12.0.0)
paperclip (~> 3.4.1)
paranoia (~> 2.4)
paypal-sdk-merchant (= 1.117.2)

View File

@@ -497,6 +497,51 @@ describe OrderCycle do
end
end
describe "version tracking", versioning: true do
let!(:oc) { create(:order_cycle, name: "Original") }
it "remembers old versions" do
expect {
oc.update!(name: "New name")
}.to change {
oc.versions.count
}.by(1)
expect(oc.versions.last.reify.name).to eq "Original"
end
# Needs additional gem:
# https://github.com/westonganger/paper_trail-association_tracking
xit "records versions when adding schedules" do
pending "seems broken with current version"
expect {
# Creating a schedule associates it automatically:
create(:schedule)
expect(oc.schedules.count).to eq 1
}.to change {
oc.versions.count
}.by(1)
end
it "records associated schedules" do
schedule = create(:schedule)
expect(oc.reload.schedules).to eq [schedule]
oc.update!(name: "New name")
expect(oc.versions.last.custom_data).to eq "[#{schedule.id}]"
end
it "remembers schedules of the previous version" do
schedule = create(:schedule)
expect(oc.reload.schedules).to eq [schedule]
oc.update!(name: "New name", schedules: [])
pending "gathering schedule ids before save"
expect(oc.versions.last.custom_data).to eq "[#{schedule.id}]"
end
end
def core_exchange_attributes(exchange)
exterior_attribute_keys = %w(id order_cycle_id created_at updated_at)
exchange.attributes.