diff options
Diffstat (limited to 'spec/views/groups/_home_panel.html.haml_spec.rb')
-rw-r--r-- | spec/views/groups/_home_panel.html.haml_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/views/groups/_home_panel.html.haml_spec.rb b/spec/views/groups/_home_panel.html.haml_spec.rb index b8168b20450..e76862cdaea 100644 --- a/spec/views/groups/_home_panel.html.haml_spec.rb +++ b/spec/views/groups/_home_panel.html.haml_spec.rb @@ -14,4 +14,30 @@ RSpec.describe 'groups/_home_panel' do expect(rendered).to have_content("Group ID: #{group.id}") end + + context 'admin area link' do + 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_group_path(group)) + 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_group_path(group)) + 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_group_path(group)) + end + end end |