Commit 4dbf7d66 authored by Stan Hu's avatar Stan Hu

Merge branch '57612-github-importer-ignores-milestone-due_date' into 'master'

Resolve "Github importer ignores Milestone due_date"

Closes #57612

See merge request gitlab-org/gitlab-ce!25182
parents bc4ee49e 9c498b10
---
title: Capture due date when importing milestones from Github
merge_request: 25182
author: dstanley
type: changed
...@@ -42,6 +42,7 @@ module Gitlab ...@@ -42,6 +42,7 @@ module Gitlab
description: milestone.description, description: milestone.description,
project_id: project.id, project_id: project.id,
state: state_for(milestone), state: state_for(milestone),
due_date: milestone.due_on&.to_date,
created_at: milestone.created_at, created_at: milestone.created_at,
updated_at: milestone.updated_at updated_at: milestone.updated_at
} }
......
...@@ -4,6 +4,7 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis ...@@ -4,6 +4,7 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis
let(:project) { create(:project, import_source: 'foo/bar') } let(:project) { create(:project, import_source: 'foo/bar') }
let(:client) { double(:client) } let(:client) { double(:client) }
let(:importer) { described_class.new(project, client) } let(:importer) { described_class.new(project, client) }
let(:due_on) { Time.new(2017, 2, 1, 12, 00) }
let(:created_at) { Time.new(2017, 1, 1, 12, 00) } let(:created_at) { Time.new(2017, 1, 1, 12, 00) }
let(:updated_at) { Time.new(2017, 1, 1, 12, 15) } let(:updated_at) { Time.new(2017, 1, 1, 12, 15) }
...@@ -14,6 +15,20 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis ...@@ -14,6 +15,20 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis
title: '1.0', title: '1.0',
description: 'The first release', description: 'The first release',
state: 'open', state: 'open',
due_on: due_on,
created_at: created_at,
updated_at: updated_at
)
end
let(:milestone2) do
double(
:milestone,
number: 1,
title: '1.0',
description: 'The first release',
state: 'open',
due_on: nil,
created_at: created_at, created_at: created_at,
updated_at: updated_at updated_at: updated_at
) )
...@@ -72,6 +87,7 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis ...@@ -72,6 +87,7 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis
describe '#build' do describe '#build' do
let(:milestone_hash) { importer.build(milestone) } let(:milestone_hash) { importer.build(milestone) }
let(:milestone_hash2) { importer.build(milestone2) }
it 'returns the attributes of the milestone as a Hash' do it 'returns the attributes of the milestone as a Hash' do
expect(milestone_hash).to be_an_instance_of(Hash) expect(milestone_hash).to be_an_instance_of(Hash)
...@@ -98,6 +114,14 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis ...@@ -98,6 +114,14 @@ describe Gitlab::GithubImport::Importer::MilestonesImporter, :clean_gitlab_redis
expect(milestone_hash[:state]).to eq(:active) expect(milestone_hash[:state]).to eq(:active)
end end
it 'includes the due date' do
expect(milestone_hash[:due_date]).to eq(due_on.to_date)
end
it 'responds correctly to no due date value' do
expect(milestone_hash2[:due_date]).to be nil
end
it 'includes the created timestamp' do it 'includes the created timestamp' do
expect(milestone_hash[:created_at]).to eq(created_at) expect(milestone_hash[:created_at]).to eq(created_at)
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