Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/github_import/importer/issues_importer_spec.rb')
-rw-r--r--spec/lib/gitlab/github_import/importer/issues_importer_spec.rb33
1 files changed, 26 insertions, 7 deletions
diff --git a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
index 6b807bdf098..308b8185589 100644
--- a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
@@ -9,20 +9,19 @@ RSpec.describe Gitlab::GithubImport::Importer::IssuesImporter do
let(:updated_at) { Time.new(2017, 1, 1, 12, 15) }
let(:github_issue) do
- double(
- :response,
+ {
number: 42,
title: 'My Issue',
body: 'This is my issue',
- milestone: double(:milestone, number: 4),
+ milestone: { number: 4 },
state: 'open',
- assignees: [double(:user, id: 4, login: 'alice')],
- labels: [double(:label, name: 'bug')],
- user: double(:user, id: 4, login: 'alice'),
+ assignees: [{ id: 4, login: 'alice' }],
+ labels: [{ name: 'bug' }],
+ user: { id: 4, login: 'alice' },
created_at: created_at,
updated_at: updated_at,
pull_request: false
- )
+ }
end
describe '#parallel?' do
@@ -110,4 +109,24 @@ RSpec.describe Gitlab::GithubImport::Importer::IssuesImporter do
.to eq(42)
end
end
+
+ describe '#increment_object_counter?' do
+ let(:importer) { described_class.new(project, client) }
+
+ context 'when issue is a pull request' do
+ let(:github_issue) { { pull_request: { url: 'some_url' } } }
+
+ it 'returns false' do
+ expect(importer).not_to be_increment_object_counter(github_issue)
+ end
+ end
+
+ context 'when issue is a regular issue' do
+ let(:github_issue) { {} }
+
+ it 'returns true' do
+ expect(importer).to be_increment_object_counter(github_issue)
+ end
+ end
+ end
end