summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2019-07-03 19:44:05 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2019-07-10 17:15:43 +0200
commit32184839c3983babe53ea93fc16b7cde5ada95f6 (patch)
tree80b91701e08c15eafd49f7449e238847736244e2 /spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb
parente787676b3752405cbe4ae75788c6cff53154783d (diff)
downloadgitlab-ce-32184839c3983babe53ea93fc16b7cde5ada95f6.tar.gz
Fetch users from Phabricator to link to issues
We fetch the users from Phabricator based on their Phabricator ID. If a user with the same username exists and is a member of the project, we set them as assignee or author. When a user is applicable, we also cache it in Redis so we don't have to perform the request again for the same phid.
Diffstat (limited to 'spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb')
-rw-r--r--spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb b/spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb
new file mode 100644
index 00000000000..00778ad90fd
--- /dev/null
+++ b/spec/lib/gitlab/phabricator_import/conduit/users_response_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+describe Gitlab::PhabricatorImport::Conduit::UsersResponse do
+ let(:conduit_response) do
+ Gitlab::PhabricatorImport::Conduit::Response
+ .new(JSON.parse(fixture_file('phabricator_responses/user.search.json')))
+ end
+
+ subject(:response) { described_class.new(conduit_response) }
+
+ describe '#users' do
+ it 'builds the correct users representation' do
+ tasks = response.users
+
+ usernames = tasks.map(&:username)
+
+ expect(usernames).to contain_exactly('jane', 'john')
+ end
+ end
+end