add test and fix association to piece jointe

This commit is contained in:
Tanguy PATTE 2015-08-17 11:41:57 +02:00
parent e53c808b42
commit bf0164b4c7
2 changed files with 15 additions and 0 deletions

View file

@ -1,8 +1,11 @@
class PieceJointe < ActiveRecord::Base
belongs_to :dossier
belongs_to :type_piece_jointe
mount_uploader :content, PieceJointeUploader
# TODO: remove this function, find another way
def self.get_array_id_pj_valid_for_dossier(dossier_id)
@array_id_pj_valides = []
where(dossier_id: dossier_id).each do |pj_valide|

View file

@ -0,0 +1,12 @@
require 'spec_helper'
describe PieceJointe do
describe 'database columns' do
it { is_expected.to have_db_column(:content) }
end
describe 'associations' do
it { is_expected.to belong_to(:dossier) }
it { is_expected.to belong_to(:type_piece_jointe) }
end
end