add test for model dossier
This commit is contained in:
parent
147a27786e
commit
b9a08f6422
2 changed files with 25 additions and 3 deletions
|
@ -12,6 +12,4 @@ class Dossier < ActiveRecord::Base
|
|||
def get_pj piece_jointe_id
|
||||
pieces_jointes.where(type_piece_jointe_id: piece_jointe_id).last
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,30 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Dossier do
|
||||
|
||||
describe 'database columns' do
|
||||
it { is_expected.to have_db_column(:description) }
|
||||
it { is_expected.to have_db_column(:autorisation_donnees) }
|
||||
it { is_expected.to have_db_column(:position_lat) }
|
||||
it { is_expected.to have_db_column(:position_lon) }
|
||||
it { is_expected.to have_db_column(:ref_dossier) }
|
||||
it { is_expected.to have_db_column(:nom_projet) }
|
||||
it { is_expected.to have_db_column(:montant_projet) }
|
||||
it { is_expected.to have_db_column(:montant_aide_demande) }
|
||||
it { is_expected.to have_db_column(:date_previsionnelle) }
|
||||
it { is_expected.to have_db_column(:lien_plus_infos) }
|
||||
it { is_expected.to have_db_column(:mail_contact) }
|
||||
it { is_expected.to have_db_column(:dossier_termine) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { is_expected.to belong_to(:formulaire) }
|
||||
it { is_expected.to have_many(:pieces_jointes) }
|
||||
it { is_expected.to have_many(:commentaires) }
|
||||
it { is_expected.to have_one(:etablissement) }
|
||||
it { is_expected.to have_one(:entreprise) }
|
||||
end
|
||||
|
||||
let(:dossier) { create(:dossier, :with_entreprise) }
|
||||
|
||||
let(:entreprise) { dossier.entreprise }
|
||||
|
@ -20,7 +44,7 @@ describe Dossier do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#liste_piece_justificative' do
|
||||
describe '#types_piece_jointe' do
|
||||
subject { dossier.types_piece_jointe }
|
||||
it 'returns list of required piece justificative' do
|
||||
expect(subject.size).to eq(7)
|
||||
|
|
Loading…
Reference in a new issue