forked from demarches-simplifiees/demarches-simplifiees.fr
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from govpf/feature/refactor_table_row_selector…
…_to_referentiel_de_polynesie Feature/refactor table row selector to referentiel de polynesie
- Loading branch information
Showing
34 changed files
with
550 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ble_champ/table_row_selector_component.rb → ...amp/referentiel_de_polynesie_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...s/champs/table_row_selector_controller.rb → ...ps/referentiel_de_polynesie_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/lib/table_row_selector/baserow_api.rb → ...b/referentiel_de_polynesie/baserow_api.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...models/champs/table_row_selector_champ.rb → .../champs/referentiel_de_polynesie_champ.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
app/models/types_de_champ/referentiel_de_polynesie_type_de_champ.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
class TypesDeChamp::ReferentielDePolynesieTypeDeChamp < TypesDeChamp::TypeDeChampBase | ||
end |
4 changes: 0 additions & 4 deletions
4
app/models/types_de_champ/table_row_selector_type_de_champ.rb
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/tasks/deployment/20241017092100_feature_flag_referentiel_de_polynesie_champs.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace :after_party do | ||
desc 'Deployment task: Enable feature flag for referentiel_de_polynesie' | ||
task feature_flag_referentiel_de_polynesie: :environment do | ||
puts "Running deploy task 'feature_flag_referentiel_de_polynesie'" | ||
|
||
progress = ProgressReport.new(User.count) | ||
User.find_each do |user| | ||
if Flipper.enabled?(:referentiel_de_polynesie, user) && user.administrateur? | ||
user.administrateur.procedures.each do |procedure| | ||
if procedure.types_de_champ_for_tags.where(type_champ: 'referentiel_de_polynesie').any? | ||
Flipper.enable(:referentiel_de_polynesie, procedure) | ||
end | ||
end | ||
Flipper.disable(:referentiel_de_polynesie, user) | ||
end | ||
progress.inc | ||
end | ||
|
||
progress.finish | ||
|
||
AfterParty::TaskRecord | ||
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
spec/lib/tasks/deployment/20241021111111_feature_flag_referentiel_de_polynesie.rake_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
describe 'deployment:20241021111111:feature_flag_referentiel_de_polynesie' do | ||
let(:rake_task) { Rake::Task['after_party:feature_flag_referentiel_de_polynesie'] } | ||
let!(:procedure_with_admin_featured) { create(:procedure) } | ||
let!(:types_de_champ_private) { [{ type: :referentiel_de_polynesie }] } | ||
let!(:procedure_with_referentiel_de_polynesie_with_admin_featured) { create(:procedure, types_de_champ_private:, administrateurs: [procedure_with_admin_featured.administrateurs.first]) } | ||
let!(:procedure_without_admin_featured) { create(:procedure) } | ||
let!(:procedure_with_referentiel_de_polynesie_without_admin_featured) { create(:procedure, types_de_champ_private:, administrateurs: [procedure_without_admin_featured.administrateurs.first]) } | ||
|
||
subject(:run_task) do | ||
rake_task.invoke | ||
end | ||
|
||
before { Flipper.enable(:referentiel_de_polynesie, procedure_with_admin_featured.administrateurs.first.user) } | ||
|
||
after { rake_task.reenable } | ||
|
||
describe 'feature_flag_referentiel_de_polynesie' do | ||
it "with bad champs" do | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_admin_featured.administrateurs.first.user)).to eq(true) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_admin_featured)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_referentiel_de_polynesie_with_admin_featured)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_without_admin_featured)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_referentiel_de_polynesie_without_admin_featured)).to eq(false) | ||
|
||
run_task | ||
|
||
procedure_with_admin_featured.reload | ||
procedure_with_referentiel_de_polynesie_with_admin_featured.reload | ||
procedure_without_admin_featured.reload | ||
procedure_with_referentiel_de_polynesie_without_admin_featured.reload | ||
|
||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_admin_featured.administrateurs.first.user)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_admin_featured)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_referentiel_de_polynesie_with_admin_featured)).to eq(true) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_without_admin_featured)).to eq(false) | ||
expect(Flipper.enabled?(:referentiel_de_polynesie, procedure_with_referentiel_de_polynesie_without_admin_featured)).to eq(false) | ||
end | ||
end | ||
end |
Oops, something went wrong.