Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
7dc27993
There was an error fetching the commit references. Please try again later.
Commit
7dc27993
authored
4 years ago
by
Max Orefice
3️⃣
Committed by
Douglas Barbosa Alexandre
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add AccessibilityReportsService class
parent
98a943b8
No related branches found
No related tags found
1 merge request
!31734
Update stable branch 13-0-stable-ee for automatic RC 13.0.0-rc20200512114055
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/ci/compare_accessibility_reports_service.rb
+17
-0
17 additions, 0 deletions
app/services/ci/compare_accessibility_reports_service.rb
spec/services/ci/compare_accessibility_reports_service_spec.rb
+62
-0
62 additions, 0 deletions
...services/ci/compare_accessibility_reports_service_spec.rb
with
79 additions
and
0 deletions
app/services/ci/compare_accessibility_reports_service.rb
0 → 100644
+
17
−
0
View file @
7dc27993
# frozen_string_literal: true
module
Ci
class
CompareAccessibilityReportsService
<
CompareReportsBaseService
def
comparer_class
Gitlab
::
Ci
::
Reports
::
AccessibilityReportsComparer
end
def
serializer_class
AccessibilityReportsComparerSerializer
end
def
get_report
(
pipeline
)
pipeline
&
.
accessibility_reports
end
end
end
This diff is collapsed.
Click to expand it.
spec/services/ci/compare_accessibility_reports_service_spec.rb
0 → 100644
+
62
−
0
View file @
7dc27993
# frozen_string_literal: true
require
'spec_helper'
describe
Ci
::
CompareAccessibilityReportsService
do
let
(
:service
)
{
described_class
.
new
(
project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
describe
'#execute'
do
subject
{
service
.
execute
(
base_pipeline
,
head_pipeline
)
}
context
'when head pipeline has accessibility reports'
do
let
(
:base_pipeline
)
{
nil
}
let
(
:head_pipeline
)
{
create
(
:ci_pipeline
,
:with_accessibility_reports
,
project:
project
)
}
it
'returns status and data'
do
expect
(
subject
[
:status
]).
to
eq
(
:parsed
)
expect
(
subject
[
:data
]).
to
match_schema
(
'entities/accessibility_reports_comparer'
)
end
end
context
'when base and head pipelines have accessibility reports'
do
let
(
:base_pipeline
)
{
create
(
:ci_pipeline
,
:with_accessibility_reports
,
project:
project
)
}
let
(
:head_pipeline
)
{
create
(
:ci_pipeline
,
:with_accessibility_reports
,
project:
project
)
}
it
'returns status and data'
do
expect
(
subject
[
:status
]).
to
eq
(
:parsed
)
expect
(
subject
[
:data
]).
to
match_schema
(
'entities/accessibility_reports_comparer'
)
end
end
end
describe
'#latest?'
do
subject
{
service
.
latest?
(
base_pipeline
,
head_pipeline
,
data
)
}
let!
(
:base_pipeline
)
{
nil
}
let!
(
:head_pipeline
)
{
create
(
:ci_pipeline
,
:with_accessibility_reports
,
project:
project
)
}
let!
(
:key
)
{
service
.
send
(
:key
,
base_pipeline
,
head_pipeline
)
}
context
'when cache key is latest'
do
let
(
:data
)
{
{
key:
key
}
}
it
{
is_expected
.
to
be_truthy
}
end
context
'when cache key is outdated'
do
before
do
head_pipeline
.
update_column
(
:updated_at
,
10
.
minutes
.
ago
)
end
let
(
:data
)
{
{
key:
key
}
}
it
{
is_expected
.
to
be_falsy
}
end
context
'when cache key is empty'
do
let
(
:data
)
{
{
key:
nil
}
}
it
{
is_expected
.
to
be_falsy
}
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment