summaryrefslogtreecommitdiff
path: root/spec/serializers/analytics_build_entity_spec.rb
blob: 24040034f68a4985a0d212ba4079a4b240e38821 (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
require 'spec_helper'

describe AnalyticsBuildEntity do
  let(:entity) do
    described_class.new(build, request: double)
  end

  context 'when build is a regular job' do
    let(:user) { create(:user) }
    let(:build) { create(:ci_build, author: user) }

    subject { entity.as_json }

    it 'contains URLs' do
      expect(subject).to include(:url, :branch_url, :commit_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