2015-08-18 13:52:00 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Cerfa do
|
|
|
|
describe 'database columns' do
|
2015-08-20 17:30:17 +02:00
|
|
|
it { is_expected.to have_db_column(:content) }
|
2016-03-14 17:30:22 +01:00
|
|
|
it { is_expected.to have_db_column(:created_at) }
|
2015-08-18 13:52:00 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'associations' do
|
|
|
|
it { is_expected.to belong_to(:dossier) }
|
2016-03-17 17:33:38 +01:00
|
|
|
it { is_expected.to belong_to(:user) }
|
2015-08-18 13:52:00 +02:00
|
|
|
end
|
|
|
|
|
2015-08-18 16:30:57 +02:00
|
|
|
describe 'empty?' do
|
2015-08-20 17:30:17 +02:00
|
|
|
subject { create(:cerfa, content: content) }
|
2015-08-18 16:30:57 +02:00
|
|
|
context 'when content exist' do
|
2015-09-21 17:59:03 +02:00
|
|
|
let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') }
|
2015-08-18 16:30:57 +02:00
|
|
|
it { expect(subject).not_to be_empty }
|
|
|
|
end
|
|
|
|
context 'when content is nil' do
|
|
|
|
let(:content) { nil }
|
|
|
|
it { expect(subject).to be_empty }
|
|
|
|
end
|
|
|
|
end
|
2015-08-20 17:30:17 +02:00
|
|
|
end
|