Stop using Flipflop as switch for weekly_overview

This commit is contained in:
Paul Chavard 2019-07-31 12:26:07 +02:00
parent 25db21467d
commit 6cfad01d12
4 changed files with 7 additions and 5 deletions

View file

@ -3,7 +3,7 @@ class WeeklyOverviewJob < ApplicationJob
def perform(*args)
# Feature flipped to avoid mails in staging due to unprocessed dossier
if Flipflop.weekly_overview?
if Rails.application.config.ds_weekly_overview
Gestionnaire.all
.map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] }
.reject { |_, overview| overview.nil? }

View file

@ -39,5 +39,7 @@ module TPS
# Make main application helpers available in administrate
Administrate::ApplicationController.helper(TPS::Application.helpers)
end
config.ds_weekly_overview = ENV['APP_NAME'] == 'tps'
end
end

View file

@ -31,8 +31,6 @@ Flipflop.configure do
group :production do
feature :insee_api_v3,
default: true
feature :weekly_overview,
default: ENV['APP_NAME'] == 'tps'
feature :pre_maintenance_mode
feature :maintenance_mode
end

View file

@ -8,7 +8,10 @@ RSpec.describe WeeklyOverviewJob, type: :job do
context 'if the feature is enabled' do
before do
Flipflop::FeatureSet.current.test!.switch!(:weekly_overview, true)
Rails.application.config.ds_weekly_overview = true
end
after do
Rails.application.config.ds_weekly_overview = false
end
context 'with one gestionnaire with one overview' do
@ -35,7 +38,6 @@ RSpec.describe WeeklyOverviewJob, type: :job do
context 'if the feature is disabled' do
before do
Flipflop::FeatureSet.current.test!.switch!(:weekly_overview, false)
allow(Gestionnaire).to receive(:all)
WeeklyOverviewJob.new.perform
end