trabajo-afectivo/spec/models/knowledge_base/answer_spec.rb
2021-08-16 10:20:07 +02:00

27 lines
824 B
Ruby

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
require 'models/concerns/checks_kb_client_notification_examples'
require 'models/concerns/has_tags_examples'
require 'models/contexts/factory_context'
RSpec.describe KnowledgeBase::Answer, type: :model, current_user_id: 1 do
subject!(:kb_answer) { create(:knowledge_base_answer) }
it_behaves_like 'HasTags'
include_context 'factory'
it_behaves_like 'ChecksKbClientNotification'
it { is_expected.not_to validate_presence_of(:category_id) }
it { is_expected.to belong_to(:category) }
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
end