summaryrefslogtreecommitdiff
path: root/spec/helpers/groups_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 08:27:35 +0000
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /spec/helpers/groups_helper_spec.rb
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
downloadgitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/helpers/groups_helper_spec.rb')
-rw-r--r--spec/helpers/groups_helper_spec.rb41
1 files changed, 36 insertions, 5 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb
index 08b25d64b43..8eb1b7b3b3d 100644
--- a/spec/helpers/groups_helper_spec.rb
+++ b/spec/helpers/groups_helper_spec.rb
@@ -87,15 +87,26 @@ RSpec.describe GroupsHelper do
end
describe 'group_title' do
- let(:group) { create(:group) }
- let(:nested_group) { create(:group, parent: group) }
- let(:deep_nested_group) { create(:group, parent: nested_group) }
- let!(:very_deep_nested_group) { create(:group, parent: deep_nested_group) }
+ let_it_be(:group) { create(:group) }
+ let_it_be(:nested_group) { create(:group, parent: group) }
+ let_it_be(:deep_nested_group) { create(:group, parent: nested_group) }
+ let_it_be(:very_deep_nested_group) { create(:group, parent: deep_nested_group) }
+
+ subject { helper.group_title(very_deep_nested_group) }
it 'outputs the groups in the correct order' do
- expect(helper.group_title(very_deep_nested_group))
+ expect(subject)
.to match(%r{<li style="text-indent: 16px;"><a.*>#{deep_nested_group.name}.*</li>.*<a.*>#{very_deep_nested_group.name}</a>}m)
end
+
+ it 'enqueues the elements in the breadcrumb schema list' do
+ expect(helper).to receive(:push_to_schema_breadcrumb).with(group.name, group_path(group))
+ expect(helper).to receive(:push_to_schema_breadcrumb).with(nested_group.name, group_path(nested_group))
+ expect(helper).to receive(:push_to_schema_breadcrumb).with(deep_nested_group.name, group_path(deep_nested_group))
+ expect(helper).to receive(:push_to_schema_breadcrumb).with(very_deep_nested_group.name, group_path(very_deep_nested_group))
+
+ subject
+ end
end
# rubocop:disable Layout/SpaceBeforeComma
@@ -370,6 +381,26 @@ RSpec.describe GroupsHelper do
end
end
+ describe '#show_thanks_for_purchase_banner?' do
+ subject { helper.show_thanks_for_purchase_banner? }
+
+ it 'returns true with purchased_quantity present in params' do
+ allow(controller).to receive(:params) { { purchased_quantity: '1' } }
+
+ is_expected.to be_truthy
+ end
+
+ it 'returns false with purchased_quantity not present in params' do
+ is_expected.to be_falsey
+ end
+
+ it 'returns false with purchased_quantity is empty in params' do
+ allow(controller).to receive(:params) { { purchased_quantity: '' } }
+
+ is_expected.to be_falsey
+ end
+ end
+
describe '#show_invite_banner?' do
let_it_be(:current_user) { create(:user) }
let_it_be_with_refind(:group) { create(:group) }