summaryrefslogtreecommitdiff
path: root/spec/presenters/deploy_key_presenter_spec.rb
blob: 9e50da12395c04098381fad44b580dde410699df (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe DeployKeyPresenter do
  let(:presenter) { described_class.new(deploy_key) }

  describe '#humanized_error_message' do
    subject { presenter.humanized_error_message }

    before do
      deploy_key.valid?
    end

    context 'when public key is unsupported' do
      let(:deploy_key) { build(:deploy_key, key: 'a') }

      it 'returns the custom error message' do
        expect(subject).to eq('Deploy Key must be a <a target="_blank" rel="noopener noreferrer" ' \
          'href="/help/user/ssh#supported-ssh-key-types">supported SSH public key.</a>')
      end
    end
  end
end