debian-mirror-gitlab/spec/views/groups/_home_panel.html.haml_spec.rb

44 lines
968 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'groups/_home_panel' do
2019-07-07 11:18:12 +05:30
let(:group) { create(:group) }
before do
assign(:group, group)
end
it 'renders the group ID' do
render
expect(rendered).to have_content("Group ID: #{group.id}")
end
2021-09-30 23:02:18 +05:30
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
2019-07-07 11:18:12 +05:30
end