diff options
author | James Lopez <james@jameslopez.es> | 2016-03-30 18:48:28 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-03-30 18:48:28 +0200 |
commit | 2d544d5445d12e45aea1341ab96059ca377484c1 (patch) | |
tree | f1cdd52a21f06a71bf176ce45a61fbb7f3357e53 /spec | |
parent | 3d4848615c6f6e3fc9ba51a71c5671bd39bf2fe1 (diff) | |
download | gitlab-ce-2d544d5445d12e45aea1341ab96059ca377484c1.tar.gz |
spec and fix for fogbugz lonely user problem
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/fogbugz_import/client_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/fogbugz_import/client_spec.rb b/spec/lib/gitlab/fogbugz_import/client_spec.rb new file mode 100644 index 00000000000..1658348e37f --- /dev/null +++ b/spec/lib/gitlab/fogbugz_import/client_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe Gitlab::FogbugzImport::Client, lib: true do + + let(:client) { Gitlab::FogbugzImport::Client.new(uri: '', token: '') } + let(:one_user) { { 'people' => { 'person' => { "ixPerson" => "2", "sFullName" => "James" } } } } + let(:two_users) { { 'people' => { 'person' => [one_user, { "ixPerson" => "3" }] } } } + + it 'retrieves user_map with one user' do + stub_api(one_user) + + expect(client.user_map.count).to eq(1) + end + + it 'retrieves user_map with two users' do + stub_api(two_users) + + expect(client.user_map.count).to eq(2) + end + + def stub_api(users) + allow_any_instance_of(::Fogbugz::Interface).to receive(:command).with(:listPeople).and_return(users) + end +end |