Merge pull request #985 from sgmap/fix-164
[Fix #164] Make the organisme field mandatory
This commit is contained in:
commit
1d2c409cd2
8 changed files with 25 additions and 5 deletions
|
@ -40,6 +40,7 @@ class Procedure < ActiveRecord::Base
|
|||
|
||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||
validates :organisation, presence: true, allow_blank: false, allow_nil: false
|
||||
|
||||
def hide!
|
||||
now = DateTime.now
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.alert.alert-info
|
||||
Cette procédure est publiée, certains éléments de la description ne sont plus modifiables
|
||||
|
||||
- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisme', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice' }.each do |key, value|
|
||||
- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisme*', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice' }.each do |key, value|
|
||||
.form-group
|
||||
%h4
|
||||
= value
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
fr:
|
||||
activerecord:
|
||||
attributes:
|
||||
procedure:
|
||||
organisation: Organisme
|
||||
errors:
|
||||
models:
|
||||
procedure:
|
||||
|
@ -10,3 +13,5 @@ fr:
|
|||
blank: Attribut manquant
|
||||
lien_demarche:
|
||||
blank: Attribut manquant
|
||||
organisation:
|
||||
blank: Attribut manquant
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class MakeProceduresOrganisationNotNull < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
change_column_null :procedures, :organisation, false
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171117165748) do
|
||||
ActiveRecord::Schema.define(version: 20171123125346) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -404,7 +404,7 @@ ActiveRecord::Schema.define(version: 20171117165748) do
|
|||
create_table "procedures", force: :cascade do |t|
|
||||
t.string "libelle"
|
||||
t.string "description"
|
||||
t.string "organisation"
|
||||
t.string "organisation", null: false
|
||||
t.string "direction"
|
||||
t.string "lien_demarche"
|
||||
t.datetime "created_at", null: false
|
||||
|
|
|
@ -13,6 +13,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
|||
page.find_by_id('new-procedure').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description de la procedure')")
|
||||
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
||||
page.find_by_id('save-procedure').click
|
||||
end
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
page.find_by_id('flash_message').visible?
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description de la procedure')")
|
||||
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
||||
page.find_by_id('save-procedure').click
|
||||
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.first.id.to_s))
|
||||
end
|
||||
|
@ -47,6 +48,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
page.find_by_id('new-procedure').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description de la procedure')")
|
||||
fill_in 'procedure_organisation', with: 'organisme de la procedure'
|
||||
page.find_by_id('save-procedure').click
|
||||
end
|
||||
|
||||
|
|
|
@ -57,6 +57,12 @@ describe Procedure do
|
|||
it { is_expected.to allow_value('').for(:lien_demarche) }
|
||||
it { is_expected.to allow_value('http://localhost').for(:lien_demarche) }
|
||||
end
|
||||
|
||||
context 'organisation' do
|
||||
it { is_expected.not_to allow_value(nil).for(:organisation) }
|
||||
it { is_expected.not_to allow_value('').for(:organisation) }
|
||||
it { is_expected.to allow_value('URRSAF').for(:organisation) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#types_de_champ_ordered' do
|
||||
|
|
Loading…
Reference in a new issue