blob: a6de2520c5e1ce64aaeeeef6075458bc12a227f0 (
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
|
# frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Gitlab::Utils::ErrorMessage, feature_category: :error_tracking do
let(:klass) do
Class.new do
include Gitlab::Utils::ErrorMessage
end
end
let(:message) { 'Something went wrong' }
subject(:object) { klass.new }
describe '#to_user_facing' do
it 'returns a user-facing error message with the UF prefix' do
expect(described_class.to_user_facing(message)).to eq("UF #{message}")
end
end
describe '#prefixed_error_message' do
it 'returns a message with the given prefix' do
prefix = 'ERROR'
expect(described_class.prefixed_error_message(message, prefix)).to eq("#{prefix} #{message}")
end
end
end
|