summaryrefslogtreecommitdiff
path: root/spec/views/projects/_home_panel.html.haml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/projects/_home_panel.html.haml_spec.rb')
-rw-r--r--spec/views/projects/_home_panel.html.haml_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb
index d329c57af00..78131937d3c 100644
--- a/spec/views/projects/_home_panel.html.haml_spec.rb
+++ b/spec/views/projects/_home_panel.html.haml_spec.rb
@@ -5,6 +5,38 @@ require 'spec_helper'
RSpec.describe 'projects/_home_panel' do
include ProjectForksHelper
+ context 'admin area link' do
+ let(:project) { create(:project) }
+
+ before do
+ assign(:project, project)
+ end
+
+ it 'renders admin area link for admin' do
+ allow(view).to receive(:current_user).and_return(create(:admin))
+
+ render
+
+ expect(rendered).to have_link(href: admin_project_path(project))
+ end
+
+ it 'does not render admin area link for non-admin' do
+ allow(view).to receive(:current_user).and_return(create(:user))
+
+ render
+
+ expect(rendered).not_to have_link(href: admin_project_path(project))
+ end
+
+ it 'does not render admin area link for anonymous' do
+ allow(view).to receive(:current_user).and_return(nil)
+
+ render
+
+ expect(rendered).not_to have_link(href: admin_project_path(project))
+ end
+ end
+
context 'notifications' do
let(:project) { create(:project) }