2019-06-04 03:40:48 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
require 'models/concerns/checks_kb_client_notification_examples'
|
|
|
|
require 'models/contexts/factory_context'
|
|
|
|
|
2019-09-18 17:25:04 +00:00
|
|
|
RSpec.describe KnowledgeBase::Answer, type: :model, current_user_id: 1 do
|
2019-06-04 03:40:48 +00:00
|
|
|
subject!(:kb_answer) { create(:knowledge_base_answer) }
|
|
|
|
|
|
|
|
include_context 'factory'
|
|
|
|
|
|
|
|
it_behaves_like 'ChecksKbClientNotification'
|
|
|
|
|
|
|
|
it { is_expected.not_to validate_presence_of(:category_id) }
|
|
|
|
it { is_expected.to belong_to(:category) }
|
2020-04-20 09:47:45 +00:00
|
|
|
it { expect(kb_answer.attachments).to be_blank }
|
|
|
|
|
|
|
|
context 'with attachment' do
|
|
|
|
subject(:kb_answer) { create(:knowledge_base_answer, :with_attachment) }
|
|
|
|
|
|
|
|
it { expect(kb_answer.attachments).to be_present }
|
|
|
|
end
|
2019-06-04 03:40:48 +00:00
|
|
|
end
|