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
ec558757
Commit
ec558757
authored
Mar 25, 2021
by
Jason Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor update_service_spec to use contains_exactly
parent
809a5f1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
ee/spec/services/ee/ip_restrictions/update_service_spec.rb
ee/spec/services/ee/ip_restrictions/update_service_spec.rb
+8
-5
No files found.
ee/spec/services/ee/ip_restrictions/update_service_spec.rb
View file @
ec558757
...
...
@@ -20,8 +20,11 @@ RSpec.describe EE::IpRestrictions::UpdateService do
end
it
'builds new ip_restriction records with the provided ranges'
do
expect
{
subject
}
.
to
(
change
{
group
.
ip_restrictions
.
map
(
&
:range
)
}.
from
([]).
to
(
comma_separated_ranges
.
split
(
","
)))
expect
(
group
.
ip_restrictions
.
map
(
&
:range
)).
to
be_empty
subject
expect
(
group
.
ip_restrictions
.
map
(
&
:range
)).
to
contain_exactly
(
*
comma_separated_ranges
.
split
(
','
))
end
end
end
...
...
@@ -53,7 +56,7 @@ RSpec.describe EE::IpRestrictions::UpdateService do
shared_examples
'removes all existing ip_restriction records'
do
it
'marks all the existing ip_restriction records for destruction'
do
records_marked_for_destruction
=
group
.
ip_restrictions
.
select
(
&
:marked_for_destruction?
)
expect
(
records_marked_for_destruction
.
map
(
&
:range
)).
to
eq
(
ranges
)
expect
(
records_marked_for_destruction
.
map
(
&
:range
)).
to
contain_exactly
(
*
ranges
)
end
end
...
...
@@ -65,7 +68,7 @@ RSpec.describe EE::IpRestrictions::UpdateService do
it
'builds new ip_restriction records with all of the specified ranges'
do
newly_built_ip_restriction_records
=
group
.
ip_restrictions
.
select
{
|
ip_restriction
|
ip_restriction
.
id
.
nil?
}
expect
(
newly_built_ip_restriction_records
.
map
(
&
:range
)).
to
eq
(
comma_separated_ranges
.
split
(
","
))
expect
(
newly_built_ip_restriction_records
.
map
(
&
:range
)).
to
contain_exactly
(
*
comma_separated_ranges
.
split
(
","
))
end
end
...
...
@@ -77,7 +80,7 @@ RSpec.describe EE::IpRestrictions::UpdateService do
it
'builds new ip_restriction records with only the unique ranges in the specified ranges'
do
newly_built_ip_restriction_records
=
group
.
ip_restrictions
.
select
{
|
ip_restriction
|
ip_restriction
.
id
.
nil?
}
expect
(
newly_built_ip_restriction_records
.
map
(
&
:range
)).
to
eq
(
comma_separated_ranges
.
split
(
","
).
uniq
)
expect
(
newly_built_ip_restriction_records
.
map
(
&
:range
)).
to
contain_exactly
(
*
comma_separated_ranges
.
split
(
","
).
uniq
)
end
end
end
...
...
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