2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'layouts/nav/sidebar/_group' do
|
2021-06-08 01:23:25 +05:30
|
|
|
let_it_be(:group) { create(:group) }
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:group, group)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'has nav sidebar'
|
2021-04-29 21:17:54 +05:30
|
|
|
it_behaves_like 'sidebar includes snowplow attributes', 'render', 'groups_side_navigation', 'groups_side_navigation'
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
describe 'Group context menu' do
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'has a link to the group path' do
|
|
|
|
render
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
expect(rendered).to have_link(group.name, href: group_path(group))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Group information' do
|
|
|
|
it 'has a link to the group activity path' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link('Group information', href: activity_group_path(group))
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not have a link to the details menu item' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_link('Details', href: details_group_path(group))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a link to the members page' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
|
|
|
|
expect(rendered).to have_link('Members', href: group_group_members_path(group))
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when feature flag :sidebar_refactor is disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(sidebar_refactor: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a link to the group path with the "Group overview" title' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link('Group overview', href: group_path(group))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a link to the details menu item' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link('Details', href: details_group_path(group))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not have a link to the members page' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Members' do
|
|
|
|
it 'does not have a Members menu' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_selector('.nav-item-name', text: 'Members')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when feature flag :sidebar_refactor is disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(sidebar_refactor: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has a Member menu' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_selector('.nav-item-name', text: 'Members')
|
|
|
|
expect(rendered).to have_link('Members', href: group_group_members_path(group))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|