diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-30 15:12:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-30 15:12:25 +0300 |
commit | 60273ebb302dabd6e724e4b7baf9ed7b39de5c09 (patch) | |
tree | 094133ffdc73d53c56e9779cfeb4f3a548d255c3 /spec/views/dashboard | |
parent | 0c918eb567a29de7ecfc890e8e2dd90e900e7e58 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/dashboard')
-rw-r--r-- | spec/views/dashboard/projects/_blank_state_welcome.html.haml_spec.rb | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/spec/views/dashboard/projects/_blank_state_welcome.html.haml_spec.rb b/spec/views/dashboard/projects/_blank_state_welcome.html.haml_spec.rb index edec46ad0a3..6f6596caabb 100644 --- a/spec/views/dashboard/projects/_blank_state_welcome.html.haml_spec.rb +++ b/spec/views/dashboard/projects/_blank_state_welcome.html.haml_spec.rb @@ -3,15 +3,65 @@ require 'spec_helper' RSpec.describe 'dashboard/projects/_blank_state_welcome.html.haml' do - let_it_be(:user) { create(:user) } + context 'with regular user' do + context 'with project creation enabled' do + let_it_be(:user) { create(:user) } - before do - allow(view).to receive(:current_user).and_return(user) + before do + allow(view).to receive(:current_user).and_return(user) + end + + it 'has a doc_url' do + render + + expect(rendered).to have_link(href: Gitlab::Saas.doc_url) + end + + it "shows create project panel" do + render + + expect(rendered).to include(_('Create a project')) + end + end + + context 'with project creation disabled' do + let_it_be(:user_projects_limit) { create(:user, projects_limit: 0 ) } + + before do + allow(view).to receive(:current_user).and_return(user_projects_limit) + end + + it "doesn't show create project panel" do + render + + expect(rendered).not_to include(_('Create a project')) + end + + it 'shows an alert' do + render + + expect(rendered).to include(_("You see projects here when you're added to a group or project.")) + end + end end - it 'has a doc_url' do - render + context 'with external user' do + let_it_be(:external_user) { create(:user, :external) } + + before do + allow(view).to receive(:current_user).and_return(external_user) + end + + it "doesn't show create project panel" do + render + + expect(rendered).not_to include(_('Create a project')) + end + + it 'shows an alert' do + render - expect(rendered).to have_link(href: Gitlab::Saas.doc_url) + expect(rendered).to include(_("You see projects here when you're added to a group or project.")) + end end end |