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:
authorToon Claes <toon@gitlab.com>2017-03-09 18:39:09 +0300
committerToon Claes <toon@gitlab.com>2017-03-10 12:03:03 +0300
commitc92808ed323d70c6af00cd19fb5e4ed35ce9957d (patch)
tree4992cd77091121d4e4a1546d880634abc408a0d0 /spec/lib/gitlab/url_sanitizer_spec.rb
parent7a7f487775d4ed3de5698064b90af6da6488a59b (diff)
Fix for creating a project through API when import_url is nil
The API was returning 500 when `nil` is passed for the `import_url`. In fact, it was `Gitlab::UrlSanitizer.valid?` which was throwing a `NoMethodError` when `nil` value was passed.
Diffstat (limited to 'spec/lib/gitlab/url_sanitizer_spec.rb')
-rw-r--r--spec/lib/gitlab/url_sanitizer_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/gitlab/url_sanitizer_spec.rb b/spec/lib/gitlab/url_sanitizer_spec.rb
index 2cb74629da8..3fd361de458 100644
--- a/spec/lib/gitlab/url_sanitizer_spec.rb
+++ b/spec/lib/gitlab/url_sanitizer_spec.rb
@@ -70,4 +70,12 @@ describe Gitlab::UrlSanitizer, lib: true do
expect(sanitizer.full_url).to eq('user@server:project.git')
end
end
+
+ describe '.valid?' do
+ it 'validates url strings' do
+ expect(described_class.valid?(nil)).to be(false)
+ expect(described_class.valid?('valid@project:url.git')).to be(true)
+ expect(described_class.valid?('123://invalid:url')).to be(false)
+ end
+ end
end