summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-27 00:10:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-27 00:10:25 +0000
commitbe5b24c0095930bc07c900fa25e6f2d93c6d5992 (patch)
tree3a3c505311e145411dd91b74e67db856bf738ee5 /spec/helpers
parent70cfa5e3e7e6765590a664165eac0ef00c3d05dc (diff)
downloadgitlab-ce-be5b24c0095930bc07c900fa25e6f2d93c6d5992.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/groups_helper_spec.rb40
1 files changed, 31 insertions, 9 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb
index a698507cc4c..992be7258f3 100644
--- a/spec/helpers/groups_helper_spec.rb
+++ b/spec/helpers/groups_helper_spec.rb
@@ -420,13 +420,13 @@ RSpec.describe GroupsHelper do
describe '#show_invite_banner?' do
let_it_be(:current_user) { create(:user) }
let_it_be_with_refind(:group) { create(:group) }
+ let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:users) { [current_user, create(:user)] }
- subject { helper.show_invite_banner?(group) }
-
before do
allow(helper).to receive(:current_user) { current_user }
allow(helper).to receive(:can?).with(current_user, :admin_group, group).and_return(can_admin_group)
+ allow(helper).to receive(:can?).with(current_user, :admin_group, subgroup).and_return(can_admin_group)
users.take(group_members_count).each { |user| group.add_guest(user) }
end
@@ -440,17 +440,39 @@ RSpec.describe GroupsHelper do
end
with_them do
- context 'when the group was just created' do
- before do
- flash[:notice] = "Group #{group.name} was successfully created"
+ context 'for a parent group' do
+ subject { helper.show_invite_banner?(group) }
+
+ context 'when the group was just created' do
+ before do
+ flash[:notice] = "Group #{group.name} was successfully created"
+ end
+
+ it { is_expected.to be_falsey }
end
- it { is_expected.to be_falsey }
+ context 'when no flash message' do
+ it 'returns the expected result' do
+ expect(subject).to eq(expected_result)
+ end
+ end
end
- context 'when no flash message' do
- it 'returns the expected result' do
- expect(subject).to eq(expected_result)
+ context 'for a subgroup' do
+ subject { helper.show_invite_banner?(subgroup) }
+
+ context 'when the subgroup was just created' do
+ before do
+ flash[:notice] = "Group #{subgroup.name} was successfully created"
+ end
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when no flash message' do
+ it 'returns the expected result' do
+ expect(subject).to eq(expected_result)
+ end
end
end
end