diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 5448c4416..b64f480a5 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -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 diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 713dc711d..cc115e5d6 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -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)