summaryrefslogtreecommitdiff
path: root/spec/features/profiles
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-10-02 17:00:41 +0200
committerRobert Speicher <rspeicher@gmail.com>2016-10-03 11:00:05 +0200
commitef2ed380f3af1a198761f5bd547b360165fa7a82 (patch)
treecb0a879b0772ae07ff6d5549b45b76fb2b348f05 /spec/features/profiles
parent7134599860651cc0f502581c97853a26f2fb4471 (diff)
downloadgitlab-ce-ef2ed380f3af1a198761f5bd547b360165fa7a82.tar.gz
Convert "SSH Keys" Spinach features to RSpecrs-convert-ssh-key-features
Diffstat (limited to 'spec/features/profiles')
-rw-r--r--spec/features/profiles/keys_spec.rb47
1 files changed, 43 insertions, 4 deletions
diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb
index 3b20d38c520..eb1050d21c6 100644
--- a/spec/features/profiles/keys_spec.rb
+++ b/spec/features/profiles/keys_spec.rb
@@ -1,18 +1,57 @@
require 'rails_helper'
-describe 'Profile > SSH Keys', feature: true do
+feature 'Profile > SSH Keys', feature: true do
let(:user) { create(:user) }
before do
login_as(user)
- visit profile_keys_path
end
- describe 'User adds an SSH key' do
- it 'auto-populates the title', js: true do
+ describe 'User adds a key' do
+ before do
+ visit profile_keys_path
+ end
+
+ scenario 'auto-populates the title', js: true do
fill_in('Key', with: attributes_for(:key).fetch(:key))
expect(find_field('Title').value).to eq 'dummy@gitlab.com'
end
+
+ scenario 'saves the new key' do
+ attrs = attributes_for(:key)
+
+ fill_in('Key', with: attrs[:key])
+ fill_in('Title', with: attrs[:title])
+ click_button('Add key')
+
+ expect(page).to have_content("Title: #{attrs[:title]}")
+ expect(page).to have_content(attrs[:key])
+ end
+ end
+
+ scenario 'User sees their keys' do
+ key = create(:key, user: user)
+ visit profile_keys_path
+
+ expect(page).to have_content(key.title)
+ end
+
+ scenario 'User removes a key via the key index' do
+ create(:key, user: user)
+ visit profile_keys_path
+
+ click_link('Remove')
+
+ expect(page).to have_content('Your SSH keys (0)')
+ end
+
+ scenario 'User removes a key via its details page' do
+ key = create(:key, user: user)
+ visit profile_key_path(key)
+
+ click_link('Remove')
+
+ expect(page).to have_content('Your SSH keys (0)')
end
end