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
|
||||
class_methods do
|
||||
def schedulable?
|
||||
ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
|
||||
Rails.application.config.ds_opendata_enabled
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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/',
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue