2016-11-14 12:05:13 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-11-18 02:13:34 -05:00
|
|
|
describe AnalyticsMergeRequestSerializer do
|
2017-01-27 07:02:59 -05:00
|
|
|
subject do
|
2017-02-22 11:55:08 -05:00
|
|
|
described_class
|
|
|
|
.new(project: project, entity: :merge_request)
|
|
|
|
.represent(resource)
|
2016-11-14 12:05:13 -05:00
|
|
|
end
|
|
|
|
|
2016-11-15 03:39:45 -05:00
|
|
|
let(:user) { create(:user) }
|
2016-11-14 12:05:13 -05:00
|
|
|
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",
|
2016-11-18 02:13:34 -05:00
|
|
|
state: 'open',
|
2016-11-15 03:39:45 -05:00
|
|
|
created_at: "2016-11-12 15:04:02.948604",
|
2016-11-18 02:13:34 -05:00
|
|
|
author: user
|
2016-11-15 03:39:45 -05:00
|
|
|
}
|
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 merge request' do
|
2017-01-27 07:02:59 -05:00
|
|
|
expect(subject).to include(:title, :iid, :created_at, :total_time, :url, :author, :state)
|
2016-11-14 12:05:13 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|