debian-mirror-gitlab/spec/models/label_note_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.3 KiB
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe LabelNote do
2022-04-04 11:22:00 +05:30
include Gitlab::Routing.url_helpers
2020-03-13 15:44:24 +05:30
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:label) { create(:label, project: project) }
let_it_be(:label2) { create(:label, project: project) }
2021-09-30 23:02:18 +05:30
2018-11-20 20:47:30 +05:30
let(:resource_parent) { project }
context 'when resource is issue' do
2020-03-13 15:44:24 +05:30
let_it_be(:resource) { create(:issue, project: project) }
2018-11-20 20:47:30 +05:30
it_behaves_like 'label note created from events'
2022-04-04 11:22:00 +05:30
it 'includes a link to the list of issues filtered by the label' do
note = described_class.from_events([
create(:resource_label_event, label: label, issue: resource)
])
expect(note.note_html).to include(project_issues_path(project, label_name: label.title))
end
2018-11-20 20:47:30 +05:30
end
context 'when resource is merge request' do
2020-03-13 15:44:24 +05:30
let_it_be(:resource) { create(:merge_request, source_project: project, target_project: project) }
2018-11-20 20:47:30 +05:30
it_behaves_like 'label note created from events'
2022-04-04 11:22:00 +05:30
it 'includes a link to the list of merge requests filtered by the label' do
note = described_class.from_events([
create(:resource_label_event, label: label, merge_request: resource)
])
expect(note.note_html).to include(project_merge_requests_path(project, label_name: label.title))
end
2018-11-20 20:47:30 +05:30
end
end