2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
2019-07-31 22:56:46 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'shared/_label_row.html.haml' do
|
|
|
|
label_types = {
|
|
|
|
'project label': :label,
|
|
|
|
'group label': :group_label
|
|
|
|
}
|
|
|
|
|
|
|
|
label_types.each do |label_type, label_factory|
|
2019-10-12 21:52:04 +05:30
|
|
|
let!(:label) do
|
|
|
|
label_record = create(label_factory)
|
|
|
|
label_record.present(issuable_subject: label_record.subject)
|
|
|
|
end
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
context "for a #{label_type}" do
|
2019-10-12 21:52:04 +05:30
|
|
|
before do
|
|
|
|
if label.project_label?
|
|
|
|
@project = label.project
|
|
|
|
else
|
|
|
|
@group = label.group
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
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
|