1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

fix tests with invoices

This commit is contained in:
Sylvain 2017-12-14 15:52:34 +01:00
parent 15bae4d6f4
commit a5b718d981
3 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class API::SubscriptionsController < API::ApiController
if is_subscribe
render :show, status: :created, location: @subscription
else
render json: @subscription.errors, status: :unprocessable_entity
head 422
end
end
end

View File

@ -118,7 +118,7 @@ module PDF
if invoice.invoiced_type == 'OfferDay'
details += I18n.t('invoices.subscription_extended_for_free_from_START_to_END', START:I18n.l(invoice.invoiced.start_at.to_date), END:I18n.l(invoice.invoiced.end_at.to_date))
else
subscription_end_at = DateTime.parse(subscription_expiration_date)
subscription_end_at = subscription_expiration_date.is_a?(Time) ? subscription_expiration_date : DateTime.parse(subscription_expiration_date)
subscription_start_at = subscription_end_at - subscription.plan.duration
details += I18n.t('invoices.subscription_NAME_from_START_to_END', NAME:item.description, START:I18n.l(subscription_start_at.to_date), END:I18n.l(subscription_expiration_date.to_date))
end

View File

@ -67,7 +67,7 @@ class ActiveSupport::TestCase
assert_not_nil invoice, 'Invoice was not created'
invoice_worker = InvoiceWorker.new
invoice_worker.perform(invoice.id)
invoice_worker.perform(invoice.id, invoice&.user&.subscription&.expired_at)
assert File.exist?(invoice.file), 'Invoice PDF was not generated'