summaryrefslogtreecommitdiff
path: root/spec/helpers/issuables_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/issuables_helper_spec.rb')
-rw-r--r--spec/helpers/issuables_helper_spec.rb45
1 files changed, 16 insertions, 29 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb
index e8e5adaa274..0e3752f220e 100644
--- a/spec/helpers/issuables_helper_spec.rb
+++ b/spec/helpers/issuables_helper_spec.rb
@@ -345,42 +345,29 @@ RSpec.describe IssuablesHelper do
end
end
- describe '#sidebar_milestone_tooltip_label' do
- it 'escapes HTML in the milestone title' do
- milestone = build(:milestone, title: '<img onerror=alert(1)>')
+ describe '#issuable_display_type' do
+ using RSpec::Parameterized::TableSyntax
- expect(helper.sidebar_milestone_tooltip_label(milestone)).to eq('&lt;img onerror=alert(1)&gt;<br/>Milestone')
+ where(:issuable_type, :issuable_display_type) do
+ :issue | 'issue'
+ :incident | 'incident'
+ :merge_request | 'merge request'
end
- end
-
- describe '#serialize_issuable' do
- context 'when it is a merge request' do
- let(:merge_request) { build(:merge_request) }
- let(:user) { build(:user) }
-
- before do
- allow(helper).to receive(:current_user) { user }
- end
-
- it 'has suggest_pipeline experiment enabled' do
- allow(helper).to receive(:experiment_enabled?).with(:suggest_pipeline) { true }
- expect_next_instance_of(MergeRequestSerializer) do |serializer|
- expect(serializer).to receive(:represent).with(merge_request, { serializer: 'widget', experiment_enabled: :suggest_pipeline })
- end
+ with_them do
+ let(:issuable) { build_stubbed(issuable_type) }
- helper.serialize_issuable(merge_request, serializer: 'widget')
- end
+ subject { helper.issuable_display_type(issuable) }
- it 'suggest_pipeline experiment disabled' do
- allow(helper).to receive(:experiment_enabled?).with(:suggest_pipeline) { false }
+ it { is_expected.to eq(issuable_display_type) }
+ end
+ end
- expect_next_instance_of(MergeRequestSerializer) do |serializer|
- expect(serializer).to receive(:represent).with(merge_request, { serializer: 'widget' })
- end
+ describe '#sidebar_milestone_tooltip_label' do
+ it 'escapes HTML in the milestone title' do
+ milestone = build(:milestone, title: '&lt;img onerror=alert(1)&gt;')
- helper.serialize_issuable(merge_request, serializer: 'widget')
- end
+ expect(helper.sidebar_milestone_tooltip_label(milestone)).to eq('&lt;img onerror=alert(1)&gt;<br/>Milestone')
end
end
end