diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb index 49a2ebc5d..353ba556c 100644 --- a/app/mailers/base_mailer.rb +++ b/app/mailers/base_mailer.rb @@ -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 diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 180690249..dfb92c5d4 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -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! diff --git a/test/test_helper.rb b/test/test_helper.rb index 3c7af7e67..25c8d9d66 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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'