analytics_issue_entity_spec.rb 921 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe AnalyticsIssueEntity do
4
  let(:user) { create(:user) }
5
  let(:entity_hash) do
6 7 8 9 10 11
    {
      total_time: "172802.724419",
      title: "Eos voluptatem inventore in sed.",
      iid: "1",
      id: "1",
      created_at: "2016-11-12 15:04:02.948604",
12
      author: user
13
    }
14
  end
15

16
  let(:project) { create(:project) }
17
  let(:request) { EntityRequest.new(project: project, entity: :merge_request) }
18 19

  let(:entity) do
20
    described_class.new(entity_hash, request: request, project: project)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
  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