mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
test presence of footprint debug data
This commit is contained in:
parent
db58ee28c0
commit
36e173fb43
@ -48,20 +48,22 @@ class FootprintService
|
||||
columns = FootprintService.footprint_columns(klass)
|
||||
current = FootprintService.footprint_data(klass, item, array: true)
|
||||
saved = FootprintDebug.find_by(footprint: item.footprint, klass: klass.name)
|
||||
return saved if Rails.env.test?
|
||||
|
||||
if saved.nil?
|
||||
puts "Debug data not found for #{klass} [ id: #{item.id} ]"
|
||||
else
|
||||
others = FootprintDebug.where('klass = ? AND data LIKE ? AND id != ?', klass, "#{item.id}%", saved.id)
|
||||
puts "Debug footprint for #{klass} [ id: #{item.id} ]"
|
||||
puts '-----------------------------------------'
|
||||
puts "columns: [ #{columns.join(', ')} ]"
|
||||
puts "current: #{current}"
|
||||
puts " saved: #{saved.format_data(item.id)}"
|
||||
puts '-----------------------------------------'
|
||||
puts "other possible matches IDs: #{others.map(&:id)}"
|
||||
puts '-----------------------------------------'
|
||||
item.footprint_children.map(&:debug_footprint)
|
||||
end
|
||||
others = FootprintDebug.where('klass = ? AND data LIKE ? AND id != ?', klass, "#{item.id}%", saved&.id)
|
||||
puts "other possible matches IDs: #{others.map(&:id)}"
|
||||
puts '-----------------------------------------'
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -13,6 +13,8 @@ class CreatePaymentScheduleObjects < ActiveRecord::Migration[5.2]
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
# PaymentSchedules were not in archives until now, so there's no need to regenerate the archives
|
||||
|
||||
# migrate data
|
||||
PaymentSchedule.all.each do |payment_schedule|
|
||||
PaymentScheduleObject.create!(
|
||||
|
@ -209,6 +209,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
|
||||
|
||||
# Check the resulting invoice generation and it has right price
|
||||
assert_invoice_pdf i
|
||||
assert_not_nil i.debug_footprint
|
||||
assert_equal (4 * 20) + (4 * 16), i.total / 100.0
|
||||
end
|
||||
end
|
||||
|
@ -100,6 +100,7 @@ class Events::AsUserTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
VCR.use_cassette('reserve_event_with_many_prices_and_payment_means_retrieve_invoice_from_stripe') do
|
||||
stp_intent = invoice.payment_gateway_object.gateway_object.retrieve
|
||||
|
@ -72,6 +72,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
@ -132,6 +133,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
@ -212,6 +214,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
@ -278,6 +281,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
@ -358,6 +362,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
@ -501,6 +506,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
# notification
|
||||
assert_not_empty Notification.where(attached_object: reservation)
|
||||
|
@ -74,6 +74,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -196,6 +197,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -282,6 +284,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -351,6 +354,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
assert invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -431,6 +435,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -514,6 +519,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
@ -598,6 +604,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object: reservation)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
|
||||
refute invoice.payment_gateway_object.blank?
|
||||
refute invoice.total.blank?
|
||||
|
@ -65,6 +65,7 @@ class Subscriptions::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object_type: 'Subscription', object_id: subscription.id)
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
|
@ -71,6 +71,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object_type: 'Subscription', object_id: subscription[:id])
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
@ -175,6 +176,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object_type: 'Subscription', object_id: subscription[:id])
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
|
||||
# wallet
|
||||
|
@ -73,6 +73,7 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object_type: 'Subscription', object_id: subscription[:id])
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
|
@ -74,6 +74,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest
|
||||
item = InvoiceItem.find_by(object_type: 'Subscription', object_id: subscription[:id])
|
||||
invoice = item.invoice
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
assert_equal plan.amount, invoice.total, 'Invoice total price does not match the bought subscription'
|
||||
end
|
||||
|
||||
|
@ -108,5 +108,6 @@ class WalletsTest < ActionDispatch::IntegrationTest
|
||||
assert_equal amount, (invoice.total / 100.0), 'Avoir total does not match the amount credited to the wallet'
|
||||
assert_equal amount, (invoice.invoice_items.first.amount / 100.0), 'Invoice item amount does not match'
|
||||
assert_invoice_pdf invoice
|
||||
assert_not_nil invoice.debug_footprint
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user