From 02ad729308307a107ca930485e4b5b7dae10e5dc Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Fri, 6 Jul 2018 14:36:02 +0000 Subject: (Part 2) Resolve "Recognise when a user is trying to validate a private SSH key" --- spec/features/profiles/keys_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/features/profiles') diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb index bfb17a56613..e6586fc8a0a 100644 --- a/spec/features/profiles/keys_spec.rb +++ b/spec/features/profiles/keys_spec.rb @@ -30,6 +30,20 @@ describe 'Profile > SSH Keys' do expect(find('.breadcrumbs-sub-title')).to have_link(attrs[:title]) end + it 'shows a confirmable warning if the key does not start with ssh-' do + attrs = attributes_for(:key) + + fill_in('Key', with: 'invalid-key') + fill_in('Title', with: attrs[:title]) + click_button('Add key') + + expect(page).to have_selector('.js-add-ssh-key-validation-warning') + + find('.js-add-ssh-key-validation-confirm-submit').click + + expect(page).to have_content('Key is invalid') + end + context 'when only DSA and ECDSA keys are allowed' do before do forbidden = ApplicationSetting::FORBIDDEN_KEY_VALUE -- cgit v1.2.3