Merge pull request #8302 from demarches-simplifiees/remove-feature-flag-opendata

Remove feature flag opendata
This commit is contained in:
krichtof 2022-12-20 12:59:44 +01:00 committed by GitHub
commit 32b5daeb9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 13 deletions

View file

@ -2,7 +2,7 @@ module DatagouvCronSchedulableConcern
extend ActiveSupport::Concern
class_methods do
def schedulable?
ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
Rails.application.config.ds_opendata_enabled
end
end
end

View file

@ -1,10 +1,7 @@
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
include DatagouvCronSchedulableConcern
self.schedule_expression = "every month at 4:00"
def self.schedulable?
false
end
def perform(*args)
gzip_filepath = [
'tmp/',

View file

@ -62,7 +62,7 @@
= f.label :lien_dpo, 'Lien ou email pour contacter le Délégué à la Protection des Données (DPO)'
= f.text_field :lien_dpo, class: 'form-control'
- if @procedure.feature_enabled?(:opendata)
- if Rails.application.config.ds_opendata_enabled
%h3.header-subsection= t(:opendata_header, scope: [:administrateurs, :informations])
%p.notice= t(:opendata_notice_html, scope: [:administrateurs, :informations])
%p.notice= t(:opendata, scope: [:administrateurs, :informations])

View file

@ -75,6 +75,8 @@ module TPS
status_visible_duration: 6000
}
config.ds_opendata_enabled = ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
config.skylight.probes += [:graphql]
# Custom Configuration

View file

@ -27,15 +27,15 @@ RSpec.describe Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob, type: :job
end
describe '#schedulable?' do
context "when ENV['OPENDATA_ENABLED'] == 'enabled'" do
it 'is not schedulable' do
ENV['OPENDATA_ENABLED'] = 'enabled'
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_falsy
context "when Rails.application.config.ds_opendata_enabled == 'enabled'" do
it 'is schedulable' do
Rails.application.config.ds_opendata_enabled = 'enabled'
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_truthy
end
end
context "when ENV['OPENDATA_ENABLED'] != 'enabled'" do
it 'is not schedulable' do
ENV['OPENDATA_ENABLED'] = nil
context "when Rails.application.config.ds_opendata_enabled != 'enabled'" do
it 'is schedulable' do
Rails.application.config.ds_opendata_enabled = nil
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_falsy
end
end

View file

@ -10,4 +10,24 @@ describe 'administrateurs/procedures/edit.html.haml' do
expect(rendered).to have_selector('.procedure-logos')
end
end
context 'when opendata is enabled' do
it 'asks for opendata' do
Rails.application.config.ds_opendata_enabled = true
assign(:procedure, procedure)
render
expect(rendered).to have_content('Open data')
end
end
context 'when opendata is disabled' do
it 'asks for opendata' do
Rails.application.config.ds_opendata_enabled = nil
assign(:procedure, procedure)
render
expect(rendered).not_to have_content('Open data')
end
end
end