Welcome to mirror list, hosted at ThFree Co, Russian Federation.

entity_failure_spec.rb « bulk_imports « entities « api « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 217e6c11630632244cd12e92f079371fbf91c183 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe API::Entities::BulkImports::EntityFailure, feature_category: :importers do
  let_it_be(:failure) { create(:bulk_import_failure) }

  subject { described_class.new(failure).as_json }

  it 'has the correct attributes' do
    expect(subject).to include(
      :relation,
      :exception_message,
      :exception_class,
      :correlation_id_value,
      :source_url,
      :source_title
    )
  end

  describe 'exception message' do
    it 'truncates exception message to 72 characters' do
      failure.update!(exception_message: 'a' * 100)

      expect(subject[:exception_message].length).to eq(72)
    end

    it 'removes paths from the message' do
      failure.update!(exception_message: 'Test /foo/bar')

      expect(subject[:exception_message]).to eq('Test [FILTERED]')
    end
  end
end