Commit fad53f36 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '348132-import-project-from-gitlab-com-error' into 'master'

Fix import project from gitlab.com error

See merge request gitlab-org/gitlab!76768
parents 1ff48797 699b6a02
...@@ -41,7 +41,7 @@ class Import::GitlabController < Import::BaseController ...@@ -41,7 +41,7 @@ class Import::GitlabController < Import::BaseController
override :importable_repos override :importable_repos
def importable_repos def importable_repos
client.projects(starting_page: 1, page_limit: MAX_PROJECT_PAGES, per_page: PER_PAGE_PROJECTS) client.projects(starting_page: 1, page_limit: MAX_PROJECT_PAGES, per_page: PER_PAGE_PROJECTS).to_a
end end
override :incompatible_repos override :incompatible_repos
......
...@@ -30,6 +30,14 @@ RSpec.describe Import::GitlabController do ...@@ -30,6 +30,14 @@ RSpec.describe Import::GitlabController do
expect(session[:gitlab_access_token]).to eq(token) expect(session[:gitlab_access_token]).to eq(token)
expect(controller).to redirect_to(status_import_gitlab_url) expect(controller).to redirect_to(status_import_gitlab_url)
end end
it "importable_repos should return an array" do
allow_next_instance_of(Gitlab::GitlabImport::Client) do |instance|
allow(instance).to receive(:projects).and_return([{ "id": 1 }].to_enum)
end
expect(controller.send(:importable_repos)).to be_an_instance_of(Array)
end
end end
describe "GET status" do describe "GET status" do
......
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