add test and fix association fo type piece jointe
This commit is contained in:
parent
ae3ffbd780
commit
e53c808b42
2 changed files with 24 additions and 6 deletions
|
@ -1,8 +1,4 @@
|
|||
class TypePieceJointe < ActiveRecord::Base
|
||||
|
||||
# TODO: test this methods
|
||||
def self.get_liste_piece_jointe(formulaire)
|
||||
where ("\"CERFA\" = '#{formulaire.demarche_id}'")
|
||||
end
|
||||
|
||||
has_many :pieces_jointes
|
||||
belongs_to :formulaire
|
||||
end
|
||||
|
|
22
spec/models/type_piece_jointe_spec.rb
Normal file
22
spec/models/type_piece_jointe_spec.rb
Normal 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
|
Loading…
Reference in a new issue