File: error_tracking_shared_examples.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (36 lines) | stat: -rw-r--r-- 1,614 bytes parent folder | download
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
# frozen_string_literal: true

RSpec.shared_examples 'setting sentry error data' do
  it 'sets the sentry error data correctly' do
    aggregate_failures 'testing the sentry error is correct' do
      expect(error['id']).to eq sentry_error.to_global_id.to_s
      expect(error['sentryId']).to eq sentry_error.id.to_s
      expect(error['status']).to eq sentry_error.status.upcase
      expect(error['firstSeen']).to eq sentry_error.first_seen
      expect(error['lastSeen']).to eq sentry_error.last_seen
    end
  end
end

RSpec.shared_examples 'setting stack trace error' do
  it 'sets the stack trace data correctly' do
    aggregate_failures 'testing the stack trace is correct' do
      expect(stack_trace_data['dateReceived']).to eq(sentry_stack_trace.date_received)
      expect(stack_trace_data['issueId']).to eq(sentry_stack_trace.issue_id)
      expect(stack_trace_data['stackTraceEntries']).to be_an_instance_of(Array)
      expect(stack_trace_data['stackTraceEntries'].size).to eq(sentry_stack_trace.stack_trace_entries.size)
    end
  end

  it 'sets the stack trace entry data correctly' do
    aggregate_failures 'testing the stack trace entry is correct' do
      stack_trace_entry = stack_trace_data['stackTraceEntries'].first
      model_entry = sentry_stack_trace.stack_trace_entries.first

      expect(stack_trace_entry['function']).to eq model_entry['function']
      expect(stack_trace_entry['col']).to eq model_entry['colNo']
      expect(stack_trace_entry['line']).to eq model_entry['lineNo'].to_s
      expect(stack_trace_entry['fileName']).to eq model_entry['filename']
    end
  end
end