Skip to content
Snippets Groups Projects
Unverified Commit 24261f2d authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Add the method ExternalIssue#project_id

This method returns the project's ID, making ExternalIssue slightly more
compatible with Issue (which also defines the "project_id" method).
parent 467b346f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -29,6 +29,15 @@ class ExternalIssue
@project
end
 
def project_id
@project.id
end
# Pattern used to extract `JIRA-123` issue references from text
def self.reference_pattern
@reference_pattern ||= %r{(?<issue>\b([A-Z][A-Z0-9_]+-)\d+)}
end
def to_reference(_from_project = nil)
id
end
Loading
Loading
require 'spec_helper'
 
describe ExternalIssue, models: true do
let(:project) { double('project', to_reference: 'namespace1/project1') }
let(:project) { double('project', id: 1, to_reference: 'namespace1/project1') }
let(:issue) { described_class.new('EXT-1234', project) }
 
describe 'modules' do
Loading
Loading
@@ -36,4 +36,10 @@ describe ExternalIssue, models: true do
end
end
end
describe '#project_id' do
it 'returns the ID of the project' do
expect(issue.project_id).to eq(project.id)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment