Sha256: f9f3e08dfd1c44dbc5b643e735d13bba031562a460c900768e079cf3a045bba8
Contents?: true
Size: 1.03 KB
Versions: 9
Compression:
Stored size: 1.03 KB
Contents
require 'rails_helper' module Logistics module Core RSpec.describe AdditionalDocument, type: :model do let(:dt1) { create(:document_type) } let(:dt2) { create(:document_type) } let(:dt3) { create(:document_type) } let(:dt4) { create(:document_type) } it 'has a valid factory' do expect(create(:additional_document)).to be_valid end it 'treats lookups as documentable' do cc = create(:client_category) am = create(:acquisition_mode) create(:additional_document, documentable: cc, document_type: dt1) create(:additional_document, documentable: cc, document_type: dt2) create(:additional_document, documentable: am, document_type: dt3) create(:additional_document, documentable: am, document_type: dt4) cc_documents = AdditionalDocument.where(documentable_id: cc.id, documentable_type: 'Logistics::Core::Lookup') expect(cc_documents.count).to eq 2 expect(am.additional_documents.count).to eq 2 end end end end
Version data entries
9 entries across 9 versions & 1 rubygems