mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
fix vat history usage in invoice test + fix sidekiq delay extension
This commit is contained in:
parent
4210405932
commit
35c31b96ea
@ -1,5 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Mailer configuration
|
||||
class BaseMailer < ActionMailer::Base
|
||||
default :from => ENV['DEFAULT_MAIL_FROM']
|
||||
default from: ENV['DEFAULT_MAIL_FROM']
|
||||
layout 'notifications_mailer'
|
||||
|
||||
helper :application
|
||||
|
@ -1,24 +1,28 @@
|
||||
if Rails.env.staging?
|
||||
namespace = "fablab_staging"
|
||||
else
|
||||
namespace = "fablab"
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
redis_host = ENV["REDIS_HOST"] || 'localhost'
|
||||
namespace = if Rails.env.staging?
|
||||
'fablab_staging'
|
||||
else
|
||||
'fablab'
|
||||
end
|
||||
|
||||
redis_host = ENV['REDIS_HOST'] || 'localhost'
|
||||
redis_url = "redis://#{redis_host}:6379"
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: redis_url, namespace: namespace }
|
||||
|
||||
# load sidekiq-cron schedule config
|
||||
schedule_file = "config/schedule.yml"
|
||||
schedule_file = 'config/schedule.yml'
|
||||
|
||||
if File.exists?(schedule_file)
|
||||
if File.exist?(schedule_file)
|
||||
rendered_schedule_file = ERB.new(File.read(schedule_file)).result
|
||||
Sidekiq::Cron::Job.load_from_hash YAML.load(rendered_schedule_file)
|
||||
Sidekiq::Cron::Job.load_from_hash YAML.safe_load(rendered_schedule_file)
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq.configure_client do |config|
|
||||
config.redis = { url: redis_url, namespace: namespace }
|
||||
end
|
||||
|
||||
Sidekiq::Extensions.enable_delay!
|
||||
|
@ -92,7 +92,8 @@ class ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
if Setting.find_by(name: 'invoice_VAT-active').value == 'true'
|
||||
vat_rate = Setting.find_by(name: 'invoice_VAT-rate').value.to_f
|
||||
vat_service = VatHistoryService.new
|
||||
vat_rate = vat_service.invoice_vat(invoice)
|
||||
computed_ht = sprintf('%.2f', (invoice.total / (vat_rate / 100 + 1)) / 100.0).to_f
|
||||
|
||||
assert_equal computed_ht, ht_amount, 'Total excluding taxes rendered in the PDF file is not computed correctly'
|
||||
|
Loading…
x
Reference in New Issue
Block a user