summaryrefslogtreecommitdiff
path: root/spec/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 00:06:15 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 00:06:15 +0000
commite2334f3613aae1c0f5b99d908e1c51213bfd7635 (patch)
tree8fd02806b70ffe4d49633412bfa2c7b58304095c /spec/lib/api
parent4529c19950e412f0461910585414f8633d3b1b18 (diff)
downloadgitlab-ce-e2334f3613aae1c0f5b99d908e1c51213bfd7635.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/api')
-rw-r--r--spec/lib/api/support/git_access_actor_spec.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/spec/lib/api/support/git_access_actor_spec.rb b/spec/lib/api/support/git_access_actor_spec.rb
index 63f5966faea..69637947c79 100644
--- a/spec/lib/api/support/git_access_actor_spec.rb
+++ b/spec/lib/api/support/git_access_actor_spec.rb
@@ -9,17 +9,26 @@ describe API::Support::GitAccessActor do
subject { described_class.new(user: user, key: key) }
describe '.from_params' do
+ let(:key) { create(:key) }
+
context 'with params that are valid' do
it 'returns an instance of API::Support::GitAccessActor' do
- params = { key_id: create(:key).id }
+ params = { key_id: key.id }
expect(described_class.from_params(params)).to be_instance_of(described_class)
end
end
context 'with params that are invalid' do
- it 'returns nil' do
- expect(described_class.from_params({})).to be_nil
+ it "returns an instance of #{described_class}" do
+ expect(described_class.from_params({})).to be_instance_of(described_class)
+ end
+ end
+
+ context 'when passing an identifier used gitaly' do
+ it 'finds the user based on an identifier' do
+ expect(described_class).to receive(:identify).and_call_original
+ expect(described_class.from_params(identifier: "key-#{key.id}").user).to eq(key.user)
end
end
end