Skip to content

Commit

Permalink
Valide automatiquement le compte qui crée la structure
Browse files Browse the repository at this point in the history
  • Loading branch information
shanser authored and etienneCharignon committed Mar 17, 2021
1 parent 7ad368b commit 126cfaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/controllers/nouvelles_structures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def show
end

def create
@campagne = Campagne.new campagne_parametres.merge(initialise_situations: true)
@campagne = Campagne.new campagne_parametres
if @campagne.save
redirect_to admin_campagne_path(@campagne)
else
Expand All @@ -19,6 +19,8 @@ def create
private

def campagne_parametres
params.require(:campagne).permit!
parametres = params.require(:campagne).permit!.to_h
parametres.deep_merge(initialise_situations: true,
compte_attributes: { statut_validation: :acceptee })
end
end
1 change: 1 addition & 0 deletions spec/features/nouvelle_structure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

expect(campagne.compte_id).to eq(compte.id)
expect(compte.structure_id).to eq(structure.id)
expect(compte.validation_acceptee?).to eq(true)

expect(current_path).to eq(admin_campagne_path(campagne))
end
Expand Down

0 comments on commit 126cfaa

Please sign in to comment.