diff options
author | Robert Speicher <robert@gitlab.com> | 2016-04-01 16:32:00 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-04-01 16:32:00 +0000 |
commit | 64106865dfc0c8af169b01c702099c381fc17f23 (patch) | |
tree | bff27b5f3a510778abf35c4807ef56b0d9c29ffa /spec | |
parent | a4f55888df246a36f9aac0b433f64978d540d188 (diff) | |
parent | c2d5cc91c00654e1a0a0d01271022059c803d674 (diff) | |
download | gitlab-ce-64106865dfc0c8af169b01c702099c381fc17f23.tar.gz |
Merge branch 'fix/fogbugz-import' into 'master'
spec and fix for fogbugz lonely user problem
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/14766
I encountered this issue while manually testing all import types for
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3066
This is really due to a horrible API
```
{ 'people' => { 'person' => array_of_people_or_single_person_as_hash } }
```
See merge request !3457
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..2dc71be0254 --- /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) { described_class.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 |