trabajo-afectivo/spec/system/knowledge_base_public/tag_spec.rb
2021-08-16 10:20:07 +02:00

52 lines
1.3 KiB
Ruby

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe 'Public Knowledge Base tag', type: :system, authenticated_as: false do
include_context 'basic Knowledge Base'
context 'when answer with the tag exists' do
before do
published_answer && published_answer_with_tag
visit help_tag_path(locale_name, published_answer_tag_name)
end
it 'displays tag name' do
expect(page).to have_css('h1', text: published_answer_tag_name)
end
it 'lists an answer with the tag' do
expect(page).to have_css('a', text: published_answer_with_tag.translations.first.title)
end
it 'does not list another answer' do
expect(page).to have_no_css('a', text: published_answer.translations.first.title)
end
it 'does not show empty placeholder' do
expect(page).to have_no_css('.sections-empty')
end
end
context 'when no answers with the tag exists' do
before do
published_answer
visit help_tag_path(locale_name, published_answer_tag_name)
end
it 'shows empty placeholder' do
expect(page).to have_css('.sections-empty')
end
it 'shows no links' do
expect(page).to have_no_css('.main a')
end
it 'displays tag name' do
expect(page).to have_css('h1', text: published_answer_tag_name)
end
end
end