summaryrefslogtreecommitdiff
path: root/spec/serializers/analytics_merge_request_serializer_spec.rb
blob: adf7321c7388c06a8c610850e5a02110d1b09c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AnalyticsMergeRequestSerializer do
  subject do
    described_class
      .new(entity: :merge_request)
      .represent(resource)
  end

  let(:user) { create(:user) }
  let(:project) { create(:project, name: 'my project') }
  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",
      author: user,
      project_path: project.path,
      namespace_path: project.namespace.route.path
    }
  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