Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
dbe46935eb
commit
ef5bb32f95
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Refactor specs around gpg_keys in users_controller_spec.rb
|
||||||
|
merge_request: 50337
|
||||||
|
author: Takuya Noguchi
|
||||||
|
type: other
|
||||||
|
|
@ -337,22 +337,12 @@ RSpec.describe UsersController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "user with no keys" do
|
describe "user with no keys" do
|
||||||
it "does generally work" do
|
it "responds the empty body with text/plain content type" do
|
||||||
get :gpg_keys, params: { username: user.username }
|
get :gpg_keys, params: { username: user.username }
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
end
|
|
||||||
|
|
||||||
it "renders all keys separated with a new line" do
|
|
||||||
get :gpg_keys, params: { username: user.username }
|
|
||||||
|
|
||||||
expect(response.body).to eq("")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "responds with text/plain content type" do
|
|
||||||
get :gpg_keys, params: { username: user.username }
|
|
||||||
|
|
||||||
expect(response.content_type).to eq("text/plain")
|
expect(response.content_type).to eq("text/plain")
|
||||||
|
expect(response.body).to eq("")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -371,21 +361,17 @@ RSpec.describe UsersController do
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders all verified keys separated with a new line" do
|
it "renders all verified keys separated with a new line with text/plain content type" do
|
||||||
get :gpg_keys, params: { username: user.username }
|
get :gpg_keys, params: { username: user.username }
|
||||||
|
|
||||||
|
expect(response.content_type).to eq("text/plain")
|
||||||
|
|
||||||
expect(response.body).not_to eq('')
|
expect(response.body).not_to eq('')
|
||||||
expect(response.body).to eq(user.gpg_keys.select(&:verified?).map(&:key).join("\n"))
|
expect(response.body).to eq(user.gpg_keys.select(&:verified?).map(&:key).join("\n"))
|
||||||
|
|
||||||
expect(response.body).to include(gpg_key.key)
|
expect(response.body).to include(gpg_key.key)
|
||||||
expect(response.body).to include(another_gpg_key.key)
|
expect(response.body).to include(another_gpg_key.key)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with text/plain content type" do
|
|
||||||
get :gpg_keys, params: { username: user.username }
|
|
||||||
|
|
||||||
expect(response.content_type).to eq("text/plain")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when logged out' do
|
describe 'when logged out' do
|
||||||
|
|
@ -399,21 +385,17 @@ RSpec.describe UsersController do
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders all verified keys separated with a new line" do
|
it "renders all verified keys separated with a new line with text/plain content type" do
|
||||||
get :gpg_keys, params: { username: user.username }
|
get :gpg_keys, params: { username: user.username }
|
||||||
|
|
||||||
|
expect(response.content_type).to eq("text/plain")
|
||||||
|
|
||||||
expect(response.body).not_to eq('')
|
expect(response.body).not_to eq('')
|
||||||
expect(response.body).to eq(user.gpg_keys.map(&:key).join("\n"))
|
expect(response.body).to eq(user.gpg_keys.map(&:key).join("\n"))
|
||||||
|
|
||||||
expect(response.body).to include(gpg_key.key)
|
expect(response.body).to include(gpg_key.key)
|
||||||
expect(response.body).to include(another_gpg_key.key)
|
expect(response.body).to include(another_gpg_key.key)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with text/plain content type" do
|
|
||||||
get :gpg_keys, params: { username: user.username }
|
|
||||||
|
|
||||||
expect(response.content_type).to eq("text/plain")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when revoked' do
|
describe 'when revoked' do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue