Fix some tests

This commit is contained in:
Xavier J 2016-12-26 18:37:27 +01:00
parent 9788118229
commit 4e6adf5bc3
5 changed files with 10 additions and 4 deletions

View file

@ -5,7 +5,7 @@ class Cerfa < ActiveRecord::Base
mount_uploader :content, CerfaUploader
validates :content, :file_size => {:maximum => 20.megabytes}
after_save :internal_notification
after_save :internal_notification, if: Proc.new { !dossier.nil? }
def empty?
content.blank?

View file

@ -5,7 +5,7 @@ class Champ < ActiveRecord::Base
delegate :libelle, :type_champ, :order_place, :mandatory, :description, :drop_down_list, to: :type_de_champ
after_save :internal_notification
after_save :internal_notification, if: Proc.new { !dossier.nil? }
def mandatory?
mandatory

View file

@ -13,7 +13,7 @@ class PieceJustificative < ActiveRecord::Base
validates :content, :file_size => {:maximum => 20.megabytes}
validates :content, presence: true, allow_blank: false, allow_nil: false
after_save :internal_notification
after_save :internal_notification, if: Proc.new { !dossier.nil? }
def empty?
content.blank?

View file

@ -1,5 +1,11 @@
FactoryGirl.define do
factory :commentaire do
body 'plop'
before(:create) do |commentaire, _evaluator|
unless commentaire.dossier
commentaire.dossier = create :dossier
end
end
end
end

View file

@ -3,7 +3,7 @@ FactoryGirl.define do
type_notif 'commentaire'
liste []
after(:create) do |notification, _evaluator|
before(:create) do |notification, _evaluator|
unless notification.dossier
notification.dossier = create :dossier
end