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:
authorStan Hu <stanhu@gmail.com>2018-10-17 23:02:40 +0300
committerStan Hu <stanhu@gmail.com>2018-10-17 23:16:31 +0300
commit3d82f20d1bae1ba4f67a87d66828d65c7cef651d (patch)
tree62ef2be7ad7460883a2176aa3bb4001aff68026c /spec/support/controllers
parentc09de611ea9d8cbff7a1696ee63262ef65972daa (diff)
Strip whitespace around GitHub personal access tokens
Some browsers insert a trailing whitespace after pasting the token into the field. This should help reduce confusion. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/46588
Diffstat (limited to 'spec/support/controllers')
-rw-r--r--spec/support/controllers/githubish_import_controller_shared_examples.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/support/controllers/githubish_import_controller_shared_examples.rb b/spec/support/controllers/githubish_import_controller_shared_examples.rb
index 1c1b68c12a2..140490f2dc2 100644
--- a/spec/support/controllers/githubish_import_controller_shared_examples.rb
+++ b/spec/support/controllers/githubish_import_controller_shared_examples.rb
@@ -22,6 +22,18 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do
expect(session[:"#{provider}_access_token"]).to eq(token)
expect(controller).to redirect_to(status_import_url)
end
+
+ it "strips access token with spaces" do
+ token = 'asdfasdf9876'
+
+ allow_any_instance_of(Gitlab::LegacyGithubImport::Client)
+ .to receive(:user).and_return(true)
+
+ post :personal_access_token, personal_access_token: " #{token} "
+
+ expect(session[:"#{provider}_access_token"]).to eq(token)
+ expect(controller).to redirect_to(status_import_url)
+ end
end
shared_examples 'a GitHub-ish import controller: GET new' do