Commit 265e52bb authored by John Kristensen's avatar John Kristensen

Improve the gitea importer test

The changes to the tests to support ignoring Gitea pull requests comments were
a bit of a hack. The suggestions provided by Ash McKenzie in
gitlab-org/gitlab-ce!29521 make things a bit more flexible if any future
changes need to be made to the tests.

The changes made to ignore
parent e47d9b3d
......@@ -13,27 +13,22 @@ describe Gitlab::LegacyGithubImport::Importer do
expected_called = [
:import_labels, :import_milestones, :import_pull_requests, :import_issues,
:import_wiki, :import_releases, :handle_errors
:import_wiki, :import_releases, :handle_errors,
[:import_comments, :issues],
[:import_comments, :pull_requests]
]
expected_called -= expected_not_called
aggregate_failures do
expected_called.each do |method_name|
expect(importer).to receive(method_name)
expected_called.each do |method_name, arg|
base_expectation = proc { expect(importer).to receive(method_name) }
arg ? base_expectation.call.with(arg) : base_expectation.call
end
expect(importer).to receive(:import_comments).with(:issues)
if expected_not_called.include? :import_comments_pull_requests
expect(importer).not_to receive(:import_comments).with(:pull_requests)
expected_not_called.delete_at expected_not_called.index :import_comments_pull_requests
else
expect(importer).to receive(:import_comments).with(:pull_requests)
end
expected_not_called.each do |method_name|
expect(importer).not_to receive(method_name)
expected_not_called.each do |method_name, arg|
base_expectation = proc { expect(importer).not_to receive(method_name) }
arg ? base_expectation.call.with(arg) : base_expectation.call
end
end
......@@ -295,7 +290,7 @@ describe Gitlab::LegacyGithubImport::Importer do
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute' do
let(:expected_not_called) { [:import_releases, :import_comments_pull_requests] }
let(:expected_not_called) { [:import_releases, [:import_comments, :pull_requests]] }
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute an error occurs'
it_behaves_like 'Gitlab::LegacyGithubImport unit-testing'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment