debian-mirror-gitlab/spec/features/topic_show_spec.rb

50 lines
1.7 KiB
Ruby
Raw Normal View History

2021-12-11 22:18:48 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Topic show page', feature_category: :projects do
2022-07-16 23:28:13 +05:30
let_it_be(:topic) { create(:topic, name: 'my-topic', title: 'My Topic', description: 'This is **my** topic https://google.com/ :poop: ```\ncode\n```', avatar: fixture_file_upload("spec/fixtures/dk.png", "image/png")) }
2021-12-11 22:18:48 +05:30
context 'when topic does not exist' do
let(:path) { topic_explore_projects_path(topic_name: 'non-existing') }
it 'renders 404' do
visit path
expect(status_code).to eq(404)
end
end
context 'when topic exists' do
before do
visit topic_explore_projects_path(topic_name: topic.name)
end
2022-07-16 23:28:13 +05:30
it 'shows title, avatar and description as markdown' do
expect(page).to have_content(topic.title)
expect(page).not_to have_content(topic.name)
2023-05-27 22:25:52 +05:30
expect(page).to have_selector('.gl-avatar.gl-avatar-s64')
2021-12-11 22:18:48 +05:30
expect(find('.topic-description')).to have_selector('p > strong')
expect(find('.topic-description')).to have_selector('p > a[rel]')
expect(find('.topic-description')).to have_selector('p > gl-emoji')
expect(find('.topic-description')).to have_selector('p > code')
end
context 'with associated projects' do
let!(:project) { create(:project, :public, topic_list: topic.name) }
it 'shows project list' do
visit topic_explore_projects_path(topic_name: topic.name)
expect(find('.projects-list .project-name')).to have_content(project.name)
end
end
context 'without associated projects' do
it 'shows correct empty state message' do
expect(page).to have_content('Explore public groups to find projects to contribute to.')
end
end
end
end