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
e38238d7
Commit
e38238d7
authored
Nov 02, 2020
by
Michał Zając
Committed by
Mark Chao
Nov 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve StoreReportService specs
parent
f6f3c703
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
ee/spec/services/security/store_report_service_spec.rb
ee/spec/services/security/store_report_service_spec.rb
+9
-7
No files found.
ee/spec/services/security/store_report_service_spec.rb
View file @
e38238d7
...
@@ -5,12 +5,14 @@ require 'spec_helper'
...
@@ -5,12 +5,14 @@ require 'spec_helper'
UUID_REGEXP
=
Regexp
.
new
(
"^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-"
\
UUID_REGEXP
=
Regexp
.
new
(
"^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-"
\
"([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})$"
).
freeze
"([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})$"
).
freeze
def
is_uuid_v5?
(
uuid_string
)
RSpec
::
Matchers
.
define
:be_uuid_v5
do
raise
TypeError
unless
uuid_string
.
is_a?
(
String
)
match
do
|
string
|
expect
(
string
).
to
be_a
(
String
)
uuid_components
=
uuid_
string
.
downcase
.
scan
(
UUID_REGEXP
).
first
uuid_components
=
string
.
downcase
.
scan
(
UUID_REGEXP
).
first
time_hi_and_version
=
uuid_components
[
2
].
to_i
(
16
)
time_hi_and_version
=
uuid_components
[
2
].
to_i
(
16
)
(
time_hi_and_version
>>
12
)
==
5
(
time_hi_and_version
>>
12
)
==
5
end
end
end
RSpec
.
describe
Security
::
StoreReportService
,
'#execute'
do
RSpec
.
describe
Security
::
StoreReportService
,
'#execute'
do
...
@@ -68,9 +70,9 @@ RSpec.describe Security::StoreReportService, '#execute' do
...
@@ -68,9 +70,9 @@ RSpec.describe Security::StoreReportService, '#execute' do
end
end
it
'calculates UUIDv5 for all findings'
do
it
'calculates UUIDv5 for all findings'
do
subject
uuids
=
Vulnerabilities
::
Finding
.
pluck
(
:uuid
)
uuids
=
Vulnerabilities
::
Finding
.
pluck
(
:uuid
)
expect
(
uuids
).
to
all
(
be_a
(
String
))
expect
(
uuids
).
to
all
(
be_uuid_v5
)
expect
(
uuids
.
all?
{
|
uuid
|
is_uuid_v5?
(
uuid
)
}).
to
be_truthy
end
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