Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cd1d0595
Commit
cd1d0595
authored
Mar 13, 2020
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up specs
parent
98ec91d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
spec/lib/gitlab/url_blockers/url_whitelist_spec.rb
spec/lib/gitlab/url_blockers/url_whitelist_spec.rb
+10
-13
No files found.
spec/lib/gitlab/url_blockers/url_whitelist_spec.rb
View file @
cd1d0595
...
...
@@ -14,9 +14,10 @@ describe Gitlab::UrlBlockers::UrlWhitelist do
describe
'#domain_whitelisted?'
do
let
(
:whitelist
)
{
[
'www.example.com'
,
'example.com'
]
}
let
(
:not_whitelisted
)
{
[
'subdomain.example.com'
,
'example.org'
]
}
it
'returns true if domains present in whitelist'
do
not_whitelisted
=
[
'subdomain.example.com'
,
'example.org'
]
aggregate_failures
do
whitelist
.
each
do
|
domain
|
expect
(
described_class
).
to
be_domain_whitelisted
(
domain
)
...
...
@@ -34,15 +35,14 @@ describe Gitlab::UrlBlockers::UrlWhitelist do
context
'with ports'
do
let
(
:whitelist
)
{
[
'example.io:3000'
]
}
let
(
:parsed_whitelist
)
{
[[
'example.io'
,
{
port:
3000
}]]
}
let
(
:not_whitelisted
)
do
[
it
'returns true if domain and ports present in whitelist'
do
parsed_whitelist
=
[[
'example.io'
,
{
port:
3000
}]]
not_whitelisted
=
[
'example.io'
,
[
'example.io'
,
{
port:
3001
}]
]
end
it
'returns true if domain and ports present in whitelist'
do
aggregate_failures
do
parsed_whitelist
.
each
do
|
domain_and_port
|
expect
(
described_class
).
to
be_domain_whitelisted
(
*
domain_and_port
)
...
...
@@ -136,22 +136,19 @@ describe Gitlab::UrlBlockers::UrlWhitelist do
context
'with ports'
do
let
(
:whitelist
)
{
[
'127.0.0.9:3000'
,
'[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443'
]
}
let
(
:parsed_whitelist
)
do
[
it
'returns true if ip and ports present in whitelist'
do
parsed_whitelist
=
[
[
'127.0.0.9'
,
{
port:
3000
}],
[
'[2001:db8:85a3:8d3:1319:8a2e:370:7348]'
,
{
port:
443
}]
]
end
let
(
:not_whitelisted
)
do
[
not_whitelisted
=
[
'127.0.0.9'
,
[
'127.0.0.9'
,
{
port:
3001
}],
'[2001:db8:85a3:8d3:1319:8a2e:370:7348]'
,
[
'[2001:db8:85a3:8d3:1319:8a2e:370:7348]'
,
{
port:
3001
}]
]
end
it
'returns true if ip and ports present in whitelist'
do
aggregate_failures
do
parsed_whitelist
.
each
do
|
ip_and_port
|
expect
(
described_class
).
to
be_ip_whitelisted
(
*
ip_and_port
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment