2019-09-13 09:26:31 -04:00
|
|
|
# frozen_string_literal: true
|
2019-04-18 11:51:56 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe 'shared/_label_row.html.haml' do
|
2019-04-18 11:51:56 -04:00
|
|
|
label_types = {
|
|
|
|
'project label': :label,
|
|
|
|
'group label': :group_label
|
|
|
|
}
|
|
|
|
|
|
|
|
label_types.each do |label_type, label_factory|
|
2019-07-30 08:29:17 -04:00
|
|
|
let!(:label) do
|
2020-08-18 08:10:16 -04:00
|
|
|
label_record = create(label_factory) # rubocop: disable Rails/SaveBang
|
2019-07-30 08:29:17 -04:00
|
|
|
label_record.present(issuable_subject: label_record.subject)
|
|
|
|
end
|
2019-04-18 11:51:56 -04:00
|
|
|
|
|
|
|
context "for a #{label_type}" do
|
2019-07-30 08:29:17 -04:00
|
|
|
before do
|
|
|
|
if label.project_label?
|
|
|
|
@project = label.project
|
|
|
|
else
|
|
|
|
@group = label.group
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-04-18 11:51:56 -04:00
|
|
|
it 'has a non-linked label title' do
|
|
|
|
render 'shared/label_row', label: label
|
|
|
|
|
|
|
|
expect(rendered).not_to have_css('a', text: label.title)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "has Issues link for #{label_type}" do
|
|
|
|
render 'shared/label_row', label: label
|
|
|
|
|
|
|
|
expect(rendered).to have_css('a', text: 'Issues')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "has Merge request link for #{label_type}" do
|
|
|
|
render 'shared/label_row', label: label
|
|
|
|
|
|
|
|
expect(rendered).to have_css('a', text: 'Merge requests')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|