2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe AnalyticsMergeRequestSerializer do
|
|
|
|
subject do
|
|
|
|
described_class
|
2019-10-12 21:52:04 +05:30
|
|
|
.new(entity: :merge_request)
|
2017-08-17 22:00:37 +05:30
|
|
|
.represent(resource)
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2019-10-12 21:52:04 +05:30
|
|
|
let(:project) { create(:project, name: 'my project') }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:resource) do
|
|
|
|
{
|
|
|
|
total_time: "172802.724419",
|
|
|
|
title: "Eos voluptatem inventore in sed.",
|
|
|
|
iid: "1",
|
|
|
|
id: "1",
|
|
|
|
state: 'open',
|
|
|
|
created_at: "2016-11-12 15:04:02.948604",
|
2019-10-12 21:52:04 +05:30
|
|
|
author: user,
|
|
|
|
project_path: project.path,
|
|
|
|
namespace_path: project.namespace.route.path
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is a single object provided' do
|
|
|
|
it 'contains important elements of the merge request' do
|
|
|
|
expect(subject).to include(:title, :iid, :created_at, :total_time, :url, :author, :state)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|