Commit 630742d0 authored by Nick Thomas's avatar Nick Thomas

Fix failing specs in spec/helpers/merge_requests_helper_spec.rb

parent 6214b80b
...@@ -20,24 +20,52 @@ describe MergeRequestsHelper do ...@@ -20,24 +20,52 @@ describe MergeRequestsHelper do
end end
end end
describe 'issues_sentence' do describe '#issues_sentence' do
let(:project) { create :project }
subject { issues_sentence(issues) } subject { issues_sentence(issues) }
let(:issues) do let(:issues) do
[build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)] [build(:issue, iid: 2, project: project),
build(:issue, iid: 3, project: project),
build(:issue, iid: 1, project: project)]
end end
it { is_expected.to eq('#1, #2, and #3') } it do
@project = project
is_expected.to eq('#1, #2, and #3')
end
context 'for JIRA issues' do context 'for JIRA issues' do
let(:project) { create(:empty_project) }
let(:issues) do let(:issues) do
[ [
ExternalIssue.new('JIRA-123', project),
ExternalIssue.new('JIRA-456', project), ExternalIssue.new('JIRA-456', project),
ExternalIssue.new('FOOBAR-7890', project) ExternalIssue.new('FOOBAR-7890', project),
ExternalIssue.new('JIRA-123', project)
] ]
end end
it { is_expected.to eq('FOOBAR-7890, JIRA-123, and JIRA-456') } it do
@project = project
is_expected.to eq('FOOBAR-7890, JIRA-123, and JIRA-456')
end
end
context 'for issues from multiple namespaces' do
let(:project) { create(:project) }
let(:other_project) { create(:project) }
let(:issues) do
[build(:issue, iid: 2, project: project),
build(:issue, iid: 3, project: other_project),
build(:issue, iid: 1, project: project)]
end
it do
@project = project
is_expected.to eq("#1, #2, and #{other_project.namespace.path}/#{other_project.path}#3")
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment