Commit fbd5a6c6 authored by Stan Hu's avatar Stan Hu

Add spec for User#accessible_deploy_keys

parent d3a3db42
......@@ -794,6 +794,24 @@ describe User do
end
end
describe '#accessible_deploy_keys' do
let(:user) { create(:user) }
let(:project) { create(:project) }
let!(:private_deploy_keys_project) { create(:deploy_keys_project) }
let!(:public_deploy_keys_project) { create(:deploy_keys_project) }
let!(:accessible_deploy_keys_project) { create(:deploy_keys_project, project: project) }
before do
public_deploy_keys_project.deploy_key.update(public: true)
project.add_developer(user)
end
it 'user can only see deploy keys accessible to right projects' do
expect(user.accessible_deploy_keys).to match_array([public_deploy_keys_project.deploy_key,
accessible_deploy_keys_project.deploy_key])
end
end
describe '#deploy_keys' do
include_context 'user keys'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment