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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.4 KiB
Ruby
Raw Permalink Normal View History

2021-11-11 11:23:49 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-04-23 21:23:45 +05:30
RSpec.describe 'groups/group_members/index', :aggregate_failures, feature_category: :subgroups do
let_it_be(:user) { create(:user) } # rubocop:todo RSpec/FactoryBot/AvoidCreate
let_it_be(:group) { create(:group) } # rubocop:todo RSpec/FactoryBot/AvoidCreate
2021-11-11 11:23:49 +05:30
before do
allow(view).to receive(:group_members_app_data).and_return({})
allow(view).to receive(:current_user).and_return(user)
assign(:group, group)
end
context 'when user can invite members for the group' do
before do
group.add_owner(user)
end
2022-05-07 20:08:51 +05:30
it 'renders as expected' do
render
2021-11-11 11:23:49 +05:30
2022-05-07 20:08:51 +05:30
expect(rendered).to have_content('Group members')
2022-08-27 11:52:29 +05:30
expect(rendered).to have_content("You're viewing members")
2021-11-11 11:23:49 +05:30
2022-05-07 20:08:51 +05:30
expect(rendered).to have_selector('.js-invite-group-trigger')
expect(rendered).to have_selector('.js-invite-members-trigger')
2021-11-11 11:23:49 +05:30
end
end
context 'when user can not invite members for the group' do
it 'renders as expected', :aggregate_failures do
render
expect(rendered).not_to have_content('Group members')
expect(rendered).not_to have_content('You can invite a new member')
end
end
2022-08-13 15:12:31 +05:30
context 'when @banned is nil' do
before do
assign(:banned, nil)
end
it 'calls group_members_app_data with { banned: [] }' do
expect(view).to receive(:group_members_app_data).with(group, a_hash_including(banned: []))
render
end
end
2021-11-11 11:23:49 +05:30
end