Merge pull request #8302 from demarches-simplifiees/remove-feature-flag-opendata
Remove feature flag opendata
This commit is contained in:
commit
32b5daeb9a
6 changed files with 32 additions and 13 deletions
|
@ -2,7 +2,7 @@ module DatagouvCronSchedulableConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
class_methods do
|
class_methods do
|
||||||
def schedulable?
|
def schedulable?
|
||||||
ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
|
Rails.application.config.ds_opendata_enabled
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
|
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
|
||||||
|
include DatagouvCronSchedulableConcern
|
||||||
self.schedule_expression = "every month at 4:00"
|
self.schedule_expression = "every month at 4:00"
|
||||||
|
|
||||||
def self.schedulable?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
gzip_filepath = [
|
gzip_filepath = [
|
||||||
'tmp/',
|
'tmp/',
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
= f.label :lien_dpo, 'Lien ou email pour contacter le Délégué à la Protection des Données (DPO)'
|
= 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'
|
= 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])
|
%h3.header-subsection= t(:opendata_header, scope: [:administrateurs, :informations])
|
||||||
%p.notice= t(:opendata_notice_html, scope: [:administrateurs, :informations])
|
%p.notice= t(:opendata_notice_html, scope: [:administrateurs, :informations])
|
||||||
%p.notice= t(:opendata, scope: [:administrateurs, :informations])
|
%p.notice= t(:opendata, scope: [:administrateurs, :informations])
|
||||||
|
|
|
@ -75,6 +75,8 @@ module TPS
|
||||||
status_visible_duration: 6000
|
status_visible_duration: 6000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.ds_opendata_enabled = ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
|
||||||
|
|
||||||
config.skylight.probes += [:graphql]
|
config.skylight.probes += [:graphql]
|
||||||
|
|
||||||
# Custom Configuration
|
# Custom Configuration
|
||||||
|
|
|
@ -27,15 +27,15 @@ RSpec.describe Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob, type: :job
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#schedulable?' do
|
describe '#schedulable?' do
|
||||||
context "when ENV['OPENDATA_ENABLED'] == 'enabled'" do
|
context "when Rails.application.config.ds_opendata_enabled == 'enabled'" do
|
||||||
it 'is not schedulable' do
|
it 'is schedulable' do
|
||||||
ENV['OPENDATA_ENABLED'] = 'enabled'
|
Rails.application.config.ds_opendata_enabled = 'enabled'
|
||||||
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_falsy
|
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_truthy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context "when ENV['OPENDATA_ENABLED'] != 'enabled'" do
|
context "when Rails.application.config.ds_opendata_enabled != 'enabled'" do
|
||||||
it 'is not schedulable' do
|
it 'is schedulable' do
|
||||||
ENV['OPENDATA_ENABLED'] = nil
|
Rails.application.config.ds_opendata_enabled = nil
|
||||||
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_falsy
|
expect(Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob.schedulable?).to be_falsy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,4 +10,24 @@ describe 'administrateurs/procedures/edit.html.haml' do
|
||||||
expect(rendered).to have_selector('.procedure-logos')
|
expect(rendered).to have_selector('.procedure-logos')
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue