diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-02-13 19:08:06 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-02-13 19:08:06 +0000 |
commit | 99df355ec2d6a934620254423f2a9451b88c6ab4 (patch) | |
tree | 105863d867b5fa48b95ac175d6fa857cca9f3e65 /spec/controllers | |
parent | 49e44d88b90939ece219e2cffc11119854306bd9 (diff) | |
parent | e31b982a13413151dd7317ee15aadcbde0f72edb (diff) | |
download | gitlab-ce-99df355ec2d6a934620254423f2a9451b88c6ab4.tar.gz |
Merge branch '27480_deploy_keys_should_not_show_up_in_users_keys_list' into 'master'
Make deploy key not show in User's keys list
Closes #27480
See merge request !9024
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/profiles/keys_controller_spec.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/controllers/profiles/keys_controller_spec.rb b/spec/controllers/profiles/keys_controller_spec.rb index 6bcfae0fc13..f7219690722 100644 --- a/spec/controllers/profiles/keys_controller_spec.rb +++ b/spec/controllers/profiles/keys_controller_spec.rb @@ -42,10 +42,9 @@ describe Profiles::KeysController do end describe "user with keys" do - before do - user.keys << create(:key) - user.keys << create(:another_key) - end + let!(:key) { create(:key, user: user) } + let!(:another_key) { create(:another_key, user: user) } + let!(:deploy_key) { create(:deploy_key, user: user) } it "does generally work" do get :get_keys, username: user.username @@ -53,16 +52,16 @@ describe Profiles::KeysController do expect(response).to be_success end - it "renders all keys separated with a new line" do + it "renders all non deploy keys separated with a new line" do get :get_keys, username: user.username - expect(response.body).not_to eq("") + expect(response.body).not_to eq('') expect(response.body).to eq(user.all_ssh_keys.join("\n")) - # Unique part of key 1 - expect(response.body).to match(/PWx6WM4lhHNedGfBpPJNPpZ/) - # Key 2 - expect(response.body).to match(/AQDmTillFzNTrrGgwaCKaSj/) + expect(response.body).to include(key.key.sub(' dummy@gitlab.com', '')) + expect(response.body).to include(another_key.key) + + expect(response.body).not_to include(deploy_key.key) end it "does not render the comment of the key" do |