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 :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :description, 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!
|
def hide!
|
||||||
now = DateTime.now
|
now = DateTime.now
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.alert.alert-info
|
.alert.alert-info
|
||||||
Cette procédure est publiée, certains éléments de la description ne sont plus modifiables
|
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
|
.form-group
|
||||||
%h4
|
%h4
|
||||||
= value
|
= value
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
fr:
|
fr:
|
||||||
activerecord:
|
activerecord:
|
||||||
|
attributes:
|
||||||
|
procedure:
|
||||||
|
organisation: Organisme
|
||||||
errors:
|
errors:
|
||||||
models:
|
models:
|
||||||
procedure:
|
procedure:
|
||||||
|
@ -10,3 +13,5 @@ fr:
|
||||||
blank: Attribut manquant
|
blank: Attribut manquant
|
||||||
lien_demarche:
|
lien_demarche:
|
||||||
blank: Attribut manquant
|
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.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -78,8 +78,8 @@ ActiveRecord::Schema.define(version: 20171117165748) do
|
||||||
t.string "logo"
|
t.string "logo"
|
||||||
t.string "signature"
|
t.string "signature"
|
||||||
t.boolean "activated"
|
t.boolean "activated"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.integer "procedure_id"
|
t.integer "procedure_id"
|
||||||
t.string "logo_secure_token"
|
t.string "logo_secure_token"
|
||||||
t.string "signature_secure_token"
|
t.string "signature_secure_token"
|
||||||
|
@ -404,7 +404,7 @@ ActiveRecord::Schema.define(version: 20171117165748) do
|
||||||
create_table "procedures", force: :cascade do |t|
|
create_table "procedures", force: :cascade do |t|
|
||||||
t.string "libelle"
|
t.string "libelle"
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "organisation"
|
t.string "organisation", null: false
|
||||||
t.string "direction"
|
t.string "direction"
|
||||||
t.string "lien_demarche"
|
t.string "lien_demarche"
|
||||||
t.datetime "created_at", null: false
|
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
|
page.find_by_id('new-procedure').click
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description 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
|
page.find_by_id('save-procedure').click
|
||||||
end
|
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?
|
page.find_by_id('flash_message').visible?
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description 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
|
page.find_by_id('save-procedure').click
|
||||||
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.first.id.to_s))
|
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.first.id.to_s))
|
||||||
end
|
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
|
page.find_by_id('new-procedure').click
|
||||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description 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
|
page.find_by_id('save-procedure').click
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,12 @@ describe Procedure do
|
||||||
it { is_expected.to allow_value('').for(:lien_demarche) }
|
it { is_expected.to allow_value('').for(:lien_demarche) }
|
||||||
it { is_expected.to allow_value('http://localhost').for(:lien_demarche) }
|
it { is_expected.to allow_value('http://localhost').for(:lien_demarche) }
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe '#types_de_champ_ordered' do
|
describe '#types_de_champ_ordered' do
|
||||||
|
|
Loading…
Reference in a new issue