summaryrefslogtreecommitdiff
path: root/spec/controllers/import/github_controller_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-12-10 11:52:04 -0800
committerStan Hu <stanhu@gmail.com>2018-12-10 11:56:14 -0800
commitb4e2679437558e48c9055ac499ce775cce9b191d (patch)
tree4bbaa5269b7f4e2373184f0eed2474d93a52a186 /spec/controllers/import/github_controller_spec.rb
parenteadd53b969da2704d7551069eda0b416ffb7b0e2 (diff)
downloadgitlab-ce-b4e2679437558e48c9055ac499ce775cce9b191d.tar.gz
Allow GitHub imports via token even if OAuth2 provider not configured
Previously, the GitHub importer would only work if the site configured an OAuth2 provider were configured. Users attempting to import via a GitHub personal access token would see an Error 500 due to a failed redirection. We fix this by only doing the redirection if the provider has been configured and allowing users to see the new import page. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/38524
Diffstat (limited to 'spec/controllers/import/github_controller_spec.rb')
-rw-r--r--spec/controllers/import/github_controller_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb
index 9bbd97ec305..780e49f7b93 100644
--- a/spec/controllers/import/github_controller_spec.rb
+++ b/spec/controllers/import/github_controller_spec.rb
@@ -16,6 +16,15 @@ describe Import::GithubController do
get :new
end
+
+ it "prompts for an access token if GitHub not configured" do
+ allow(controller).to receive(:github_import_configured?).and_return(false)
+ expect(controller).not_to receive(:go_to_provider_for_permissions)
+
+ get :new
+
+ expect(response).to have_http_status(200)
+ end
end
describe "GET callback" do