summaryrefslogtreecommitdiff
path: root/spec/serializers/analytics_issue_entity_spec.rb
blob: c5b03bdd8c1cc33e2f1205f98c3870edf3533779 (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
34
35
36
37
38
39
40
41
require 'spec_helper'

describe AnalyticsIssueEntity do
  let(:user) { create(:user) }
  let(:entity_hash) do
    {
      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,
      project_path: project.path,
      namespace_path: project.namespace.route.path
    }
  end

  let(:project) { create(:project, name: 'my project') }
  let(:request) { EntityRequest.new(entity: :merge_request) }

  let(:entity) do
    described_class.new(entity_hash, request: request, project: project)
  end

  context 'generic entity' do
    subject { entity.as_json }

    it 'contains the entity URL' do
      expect(subject).to include(:url)
    end

    it 'contains the author' do
      expect(subject).to include(:author)
    end

    it 'does not contain sensitive information' do
      expect(subject).not_to include(/token/)
      expect(subject).not_to include(/variables/)
    end
  end
end