remove validation on description for pj

This commit is contained in:
Tanguy PATTE 2015-11-20 15:33:03 +01:00
parent 19fef43d76
commit 5a9a6226c7
3 changed files with 7 additions and 13 deletions

View file

@ -3,5 +3,4 @@ class TypeDePieceJustificative < ActiveRecord::Base
belongs_to :procedure belongs_to :procedure
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
end end

View file

@ -9,10 +9,11 @@
%h4 Description %h4 Description
=ff.text_area :description, class: 'form-control description', placeholder: 'Description' =ff.text_area :description, class: 'form-control description', placeholder: 'Description'
- if ff.object.id.nil?
.form-group#add_type_de_piece_justificative_button .form-group
%br &nbsp; %br &nbsp;
= f.submit('Ajouter la pièce') - if ff.object.id.nil?
- else = f.submit('Ajouter la pièce', class: 'btn btn-success')
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) ) - else
= link_to("", admin_procedure_piece_justificative_path(@procedure, ff.object.id), method: :delete, remote: true, id: "delete_type_de_piece_justificative_#{ff.object.id}", class: %w(form-control btn btn-danger fa fa-trash-o) )

View file

@ -22,11 +22,5 @@ describe TypeDePieceJustificative do
it { is_expected.not_to allow_value('').for(:libelle) } it { is_expected.not_to allow_value('').for(:libelle) }
it { is_expected.to allow_value('RIB').for(:libelle) } it { is_expected.to allow_value('RIB').for(:libelle) }
end end
context 'description' do
it { is_expected.not_to allow_value(nil).for(:description) }
it { is_expected.not_to allow_value('').for(:description) }
it { is_expected.to allow_value('Releve identité bancaire').for(:description) }
end
end end
end end