2016-11-14 12:05:13 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-11-18 02:13:34 -05:00
|
|
|
describe AnalyticsIssueSerializer do
|
2016-11-14 12:05:13 -05:00
|
|
|
let(:serializer) do
|
|
|
|
described_class
|
2016-11-15 03:59:35 -05:00
|
|
|
.new(project: project, entity: :merge_request)
|
2016-11-14 12:05:13 -05:00
|
|
|
.represent(resource)
|
|
|
|
end
|
|
|
|
|
2016-11-15 03:39:45 -05:00
|
|
|
let(:user) { create(:user) }
|
2016-11-14 12:05:13 -05:00
|
|
|
let(:json) { serializer.as_json }
|
|
|
|
let(:project) { create(:project) }
|
2016-11-16 06:01:10 -05:00
|
|
|
let(:resource) do
|
2016-11-15 03:39:45 -05:00
|
|
|
{
|
|
|
|
total_time: "172802.724419",
|
|
|
|
title: "Eos voluptatem inventore in sed.",
|
|
|
|
iid: "1",
|
|
|
|
id: "1",
|
|
|
|
created_at: "2016-11-12 15:04:02.948604",
|
|
|
|
author: user,
|
|
|
|
}
|
2016-11-16 06:01:10 -05:00
|
|
|
end
|
2016-11-14 12:05:13 -05:00
|
|
|
|
|
|
|
context 'when there is a single object provided' do
|
2016-11-18 02:13:34 -05:00
|
|
|
it 'contains important elements of the issue' do
|
2016-11-15 04:33:01 -05:00
|
|
|
expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author)
|
2016-11-14 12:05:13 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|