Commit e0ef9dc8 authored by Valery Sizov's avatar Valery Sizov

BB importer: Milestone importer

parent ffa35233
......@@ -27,6 +27,10 @@ module Bitbucket
raw['title']
end
def milestone
raw.dig('milestone', 'name')
end
def created_at
raw['created_on']
end
......
......@@ -67,6 +67,7 @@ module Gitlab
description += issue.description
label_name = issue.kind
milestone = issue.milestone ? project.milestones.find_or_create_by(title: issue.milestone) : nil
issue = project.issues.create!(
iid: issue.iid,
......@@ -74,6 +75,7 @@ module Gitlab
description: description,
state: issue.state,
author_id: gitlab_user_id(project, issue.author),
milestone: milestone,
created_at: issue.created_at,
updated_at: issue.updated_at
)
......
......@@ -9,6 +9,12 @@ describe Bitbucket::Representation::Issue do
it { expect(described_class.new('kind' => 'bug').kind).to eq('bug') }
end
describe '#milestone' do
it { expect(described_class.new({ 'milestone' => { 'name' => '1.0' } }).milestone).to eq('1.0') }
it { expect(described_class.new({}).milestone).to be_nil }
end
describe '#author' do
it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' } }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to be_nil }
......
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