debian-mirror-gitlab/spec/lib/gitlab/fogbugz_import/client_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
767 B
Ruby
Raw Permalink Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::FogbugzImport::Client do
2016-06-02 11:05:42 +05:30
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)
2020-01-01 13:55:28 +05:30
allow_next_instance_of(::Fogbugz::Interface) do |instance|
allow(instance).to receive(:command).with(:listPeople).and_return(users)
end
2016-06-02 11:05:42 +05:30
end
end