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

pre_receive_error_spec.rb « git « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cb5392616712cc62a7d42280e4986460f5cf28c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Git::PreReceiveError do
  Gitlab::Git::PreReceiveError::SAFE_MESSAGE_PREFIXES.each do |prefix|
    context "error messages prefixed with #{prefix}" do
      it 'accepts only errors lines with the prefix' do
        ex = described_class.new("#{prefix} Hello,\nworld!")

        expect(ex.message).to eq('Hello,')
      end

      it 'makes its message HTML-friendly' do
        ex = described_class.new("#{prefix} Hello,\n#{prefix} world!\n")

        expect(ex.message).to eq('Hello,<br>world!')
      end
    end
  end
end