diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 12:09:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 12:09:01 +0000 |
commit | bd497e352ebd279536ae11855871162e82a3f88c (patch) | |
tree | 2241444d4be33e199d7011b872713071a8f8cd41 /spec/views | |
parent | 0388886f9439fa93efea29a159522aec5643f7c8 (diff) | |
download | gitlab-ce-bd497e352ebd279536ae11855871162e82a3f88c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/shared/projects/_list.html.haml_spec.rb | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/spec/views/shared/projects/_list.html.haml_spec.rb b/spec/views/shared/projects/_list.html.haml_spec.rb new file mode 100644 index 00000000000..d6043921fc8 --- /dev/null +++ b/spec/views/shared/projects/_list.html.haml_spec.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'shared/projects/_list' do + let(:group) { create(:group) } + + before do + allow(view).to receive(:projects).and_return(projects) + allow(view).to receive(:project_list_cache_key).and_return('fake_cache_key') + end + + context 'with projects' do + let(:projects) { build_stubbed_list(:project, 1) } + + it 'renders the list of projects' do + render + + projects.each do |project| + expect(rendered).to have_content(project.name) + end + end + end + + context 'without projects' do + let(:projects) { [] } + + context 'when @contributed_projects is set' do + context 'and is empty' do + before do + @contributed_projects = [] + end + + it 'renders a no-content message' do + render + + expect(rendered).to have_content(s_('UserProfile|This user hasn\'t contributed to any projects')) + end + end + end + + context 'when @starred_projects is set' do + context 'and is empty' do + before do + @starred_projects = [] + end + + it 'renders a no-content message' do + render + + expect(rendered).to have_content(s_('UserProfile|This user hasn\'t starred any projects')) + end + end + end + + context 'and without a special instance variable' do + context 'for an explore_page' do + before do + allow(view).to receive(:explore_page).and_return(true) + end + + it 'renders a no-content message' do + render + + expect(rendered).to have_content(s_('UserProfile|Explore public groups to find projects to contribute to.')) + end + end + + context 'for a non-explore page' do + it 'renders a no-content message' do + render + + expect(rendered).to have_content(s_('UserProfile|This user doesn\'t have any personal projects')) + end + end + end + end +end |