diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-06-04 13:57:51 +0200 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-06-04 13:57:51 +0200 |
commit | 8ffcaf3b85fdf716ffeacf4e9d4c89b922de50b9 (patch) | |
tree | 2e6acfa369e3e659ef4c6afb9290ad122a8fea5c /spec/lib/gitlab/url_blocker_spec.rb | |
parent | 1841da16abe864b3dae19636fee9e9bbe9a01b56 (diff) | |
parent | 23ae072ba2d601a3639a32f5a29302c430106bb8 (diff) | |
download | gitlab-ce-11-0-stable-prepare-rc2.tar.gz |
Merge branch 'master' into 11-0-stable-prepare-rc211-0-stable-prepare-rc2
Diffstat (limited to 'spec/lib/gitlab/url_blocker_spec.rb')
-rw-r--r-- | spec/lib/gitlab/url_blocker_spec.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/lib/gitlab/url_blocker_spec.rb b/spec/lib/gitlab/url_blocker_spec.rb index a3b3dc3be6d..81dbbb962dd 100644 --- a/spec/lib/gitlab/url_blocker_spec.rb +++ b/spec/lib/gitlab/url_blocker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Gitlab::UrlBlocker do describe '#blocked_url?' do - let(:valid_ports) { Project::VALID_IMPORT_PORTS } + let(:ports) { Project::VALID_IMPORT_PORTS } it 'allows imports from configured web host and port' do import_url = "http://#{Gitlab.config.gitlab.host}:#{Gitlab.config.gitlab.port}/t.git" @@ -19,7 +19,13 @@ describe Gitlab::UrlBlocker do end it 'returns true for bad port' do - expect(described_class.blocked_url?('https://gitlab.com:25/foo/foo.git', valid_ports: valid_ports)).to be true + expect(described_class.blocked_url?('https://gitlab.com:25/foo/foo.git', ports: ports)).to be true + end + + it 'returns true for bad protocol' do + expect(described_class.blocked_url?('https://gitlab.com/foo/foo.git', protocols: ['https'])).to be false + expect(described_class.blocked_url?('https://gitlab.com/foo/foo.git')).to be false + expect(described_class.blocked_url?('https://gitlab.com/foo/foo.git', protocols: ['http'])).to be true end it 'returns true for alternative version of 127.0.0.1 (0177.1)' do |