debian-mirror-gitlab/spec/lib/banzai/reference_parser/milestone_parser_spec.rb
2016-06-16 23:09:34 +05:30

31 lines
910 B
Ruby

require 'spec_helper'
describe Banzai::ReferenceParser::MilestoneParser, lib: true do
include ReferenceParserHelpers
let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project) }
subject { described_class.new(project, user) }
let(:link) { empty_html_link }
describe '#referenced_by' do
describe 'when the link has a data-milestone attribute' do
context 'using an existing milestone ID' do
it 'returns an Array of milestones' do
link['data-milestone'] = milestone.id.to_s
expect(subject.referenced_by([link])).to eq([milestone])
end
end
context 'using a non-existing milestone ID' do
it 'returns an empty Array' do
link['data-milestone'] = ''
expect(subject.referenced_by([link])).to eq([])
end
end
end
end
end