add test and fix association fo type piece jointe

This commit is contained in:
Tanguy PATTE 2015-08-17 11:24:09 +02:00
parent ae3ffbd780
commit e53c808b42
2 changed files with 24 additions and 6 deletions

View file

@ -1,8 +1,4 @@
class TypePieceJointe < ActiveRecord::Base class TypePieceJointe < ActiveRecord::Base
has_many :pieces_jointes
# TODO: test this methods belongs_to :formulaire
def self.get_liste_piece_jointe(formulaire)
where ("\"CERFA\" = '#{formulaire.demarche_id}'")
end
end end

View file

@ -0,0 +1,22 @@
require 'spec_helper'
describe TypePieceJointe do
describe 'database columns' do
it { is_expected.to have_db_column(:CERFA) }
it { is_expected.to have_db_column(:nature) }
it { is_expected.to have_db_column(:libelle_complet) }
it { is_expected.to have_db_column(:libelle) }
it { is_expected.to have_db_column(:etablissement) }
it { is_expected.to have_db_column(:description) }
it { is_expected.to have_db_column(:demarche) }
it { is_expected.to have_db_column(:administration_emetrice) }
it { is_expected.to have_db_column(:api_entreprise) }
it { is_expected.to have_db_column(:created_at) }
it { is_expected.to have_db_column(:updated_at) }
end
describe 'associations' do
it { is_expected.to have_many(:pieces_jointes) }
it { is_expected.to belong_to(:formulaire) }
end
end