Rename count_of_extra_tags_not_shown to count_of_extra_topics_not_shown

- Add tests for project topics
This commit is contained in:
Martin Wortschack 2019-01-14 11:26:42 +01:00
parent 94d05e3c5c
commit 308ee5f378
2 changed files with 25 additions and 1 deletions

View file

@ -23,7 +23,7 @@
= sprite_icon('tag', size: 16, css_class: 'icon append-right-4')
= @project.topics_to_show
- if @project.has_extra_topics?
= _("+ %{count} more") % { count: @project.count_of_extra_tags_not_shown }
= _("+ %{count} more") % { count: @project.count_of_extra_topics_not_shown }
.project-repo-buttons.col-md-12.col-lg-6.d-inline-flex.flex-wrap.justify-content-lg-end

View file

@ -99,6 +99,30 @@ describe 'Project' do
end
end
describe 'project topics' do
let(:project) { create(:project, :repository) }
let(:path) { project_path(project) }
before do
sign_in(create(:admin))
visit path
end
it 'shows project topics' do
project.update_attribute(:tag_list, 'topic1')
visit path
expect(page).to have_css('.project-topic-list')
expect(page).to have_content('topic1')
end
it 'shows up to 3 project tags' do
project.update_attribute(:tag_list, 'topic1, topic2, topic3, topic4')
visit path
expect(page).to have_css('.project-topic-list')
expect(page).to have_content('topic1, topic2, topic3 + 1 more')
end
end
describe 'copy clone URL to clipboard', :js do
let(:project) { create(:project, :repository) }
let(:path) { project_path(project) }