Commit 17600f5f authored by James Edwards-Jones's avatar James Edwards-Jones

Issues CSV uses Excel compatible dates

parent 91296aff
...@@ -6,9 +6,9 @@ columns = { ...@@ -6,9 +6,9 @@ columns = {
'Author' => 'author_name', 'Author' => 'author_name',
'Assignee' => 'assignee_name', 'Assignee' => 'assignee_name',
'Confidential' => 'confidential', 'Confidential' => 'confidential',
'Due Date' => 'due_date', 'Due Date' => -> (issue) { issue.due_date&.strftime('%Y-%m-%d') },
'Created At' => 'created_at', 'Created At (UTC)' => -> (issue) { issue.created_at&.strftime('%Y-%m-%d %H:%M:%S') },
'Updated At' => 'updated_at', 'Updated At (UTC)' => -> (issue) { issue.updated_at&.strftime('%Y-%m-%d %H:%M:%S') },
'Milestone' => -> (issue) { issue.milestone&.title }, 'Milestone' => -> (issue) { issue.milestone&.title },
'Labels' => -> (issue) { issue.label_names.join(',').presence }, 'Labels' => -> (issue) { issue.label_names.join(',').presence },
} }
......
...@@ -29,7 +29,14 @@ describe 'Issues csv', feature: true do ...@@ -29,7 +29,14 @@ describe 'Issues csv', feature: true do
let(:milestone) { create(:milestone, title: "v1.0", project: project) } let(:milestone) { create(:milestone, title: "v1.0", project: project) }
before do before do
issue.update!(milestone: milestone, assignee: user, description: 'Issue with details', labels: [label1, label2]) issue.update!(milestone: milestone,
assignee: user,
description: 'Issue with details',
due_date: DateTime.new(2014, 3, 2),
created_at: DateTime.new(2015, 4, 3, 2, 1, 0),
updated_at: DateTime.new(2016, 5, 4, 3, 2, 1),
labels: [label1, label2])
visit namespace_project_issues_path(project.namespace, project, format: :csv) visit namespace_project_issues_path(project.namespace, project, format: :csv)
end end
...@@ -60,6 +67,19 @@ describe 'Issues csv', feature: true do ...@@ -60,6 +67,19 @@ describe 'Issues csv', feature: true do
specify 'labels' do specify 'labels' do
expect(csv[0]['Labels']).to eq 'Feature,labels' expect(csv[0]['Labels']).to eq 'Feature,labels'
end end
specify 'due_date' do
expect(csv[0]['Due Date']).to eq '2014-03-02'
end
specify 'created_at' do
expect(csv[0]['Created At (UTC)']).to eq '2015-04-03 02:01:00'
end
specify 'updated_at' do
expect(csv[0]['Updated At (UTC)']).to eq '2016-05-04 03:02:01'
end
end end
context 'with minimal details' do context 'with minimal details' do
......
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