2019-09-30 05:06:31 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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
|
2016-11-14 12:05:13 -05:00
|
|
|
described_class
|
2019-07-04 10:42:31 -04:00
|
|
|
.new(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) }
|
2019-08-05 17:15:00 -04:00
|
|
|
let(:project) { create(:project, name: 'my 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",
|
2019-07-04 10:42:31 -04:00
|
|
|
author: user,
|
2019-08-05 17:15:00 -04:00
|
|
|
project_path: project.path,
|
|
|
|
namespace_path: project.namespace.route.path
|
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
|