answer_spec.rb 675 B

123456789101112131415161718192021
  1. require 'rails_helper'
  2. require 'models/concerns/checks_kb_client_notification_examples'
  3. require 'models/contexts/factory_context'
  4. RSpec.describe KnowledgeBase::Answer, type: :model, current_user_id: 1 do
  5. subject!(:kb_answer) { create(:knowledge_base_answer) }
  6. include_context 'factory'
  7. it_behaves_like 'ChecksKbClientNotification'
  8. it { is_expected.not_to validate_presence_of(:category_id) }
  9. it { is_expected.to belong_to(:category) }
  10. it { expect(kb_answer.attachments).to be_blank }
  11. context 'with attachment' do
  12. subject(:kb_answer) { create(:knowledge_base_answer, :with_attachment) }
  13. it { expect(kb_answer.attachments).to be_present }
  14. end
  15. end