add fonction empty for cerfa
This commit is contained in:
parent
e2ff64a119
commit
1f960a4b43
3 changed files with 20 additions and 0 deletions
|
@ -2,4 +2,8 @@ class Cerfa < ActiveRecord::Base
|
|||
belongs_to :dossier
|
||||
|
||||
mount_uploader :content, CerfaUploader
|
||||
|
||||
def empty?
|
||||
content.blank?
|
||||
end
|
||||
end
|
5
spec/factories/cerfa.rb
Normal file
5
spec/factories/cerfa.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
FactoryGirl.define do
|
||||
factory :cerfa do
|
||||
|
||||
end
|
||||
end
|
|
@ -9,4 +9,15 @@ describe Cerfa do
|
|||
it { is_expected.to belong_to(:dossier) }
|
||||
end
|
||||
|
||||
describe 'empty?' do
|
||||
subject { create(:cerfa, content: content)}
|
||||
context 'when content exist' do
|
||||
let(:content) { File.open('./spec/support/files/piece_jointe_388.pdf') }
|
||||
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
|
||||
end
|
Loading…
Reference in a new issue