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
6dfda3de
Commit
6dfda3de
authored
May 12, 2020
by
Maxime Orefice
Committed by
Imre Farkas
May 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add compare_accessibility_report to MergeRequest
parent
ccd3b3fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+56
-0
No files found.
app/models/merge_request.rb
View file @
6dfda3de
...
@@ -1317,6 +1317,14 @@ class MergeRequest < ApplicationRecord
...
@@ -1317,6 +1317,14 @@ class MergeRequest < ApplicationRecord
actual_head_pipeline
&
.
has_reports?
(
Ci
::
JobArtifact
.
terraform_reports
)
actual_head_pipeline
&
.
has_reports?
(
Ci
::
JobArtifact
.
terraform_reports
)
end
end
def
compare_accessibility_reports
unless
has_accessibility_reports?
return
{
status: :error
,
status_reason:
_
(
'This merge request does not have accessibility reports'
)
}
end
compare_reports
(
Ci
::
CompareAccessibilityReportsService
)
end
# TODO: this method and compare_test_reports use the same
# TODO: this method and compare_test_reports use the same
# result type, which is handled by the controller's #reports_response.
# result type, which is handled by the controller's #reports_response.
# we should minimize mistakes by isolating the common parts.
# we should minimize mistakes by isolating the common parts.
...
...
locale/gitlab.pot
View file @
6dfda3de
...
@@ -21626,6 +21626,9 @@ msgstr ""
...
@@ -21626,6 +21626,9 @@ msgstr ""
msgid "This means you can not push code until you create an empty repository or import existing one."
msgid "This means you can not push code until you create an empty repository or import existing one."
msgstr ""
msgstr ""
msgid "This merge request does not have accessibility reports"
msgstr ""
msgid "This merge request is locked."
msgid "This merge request is locked."
msgstr ""
msgstr ""
...
...
spec/models/merge_request_spec.rb
View file @
6dfda3de
...
@@ -1889,6 +1889,62 @@ describe MergeRequest do
...
@@ -1889,6 +1889,62 @@ describe MergeRequest do
end
end
end
end
describe
'#compare_accessibility_reports'
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:merge_request
,
reload:
true
)
{
create
(
:merge_request
,
:with_accessibility_reports
,
source_project:
project
)
}
let_it_be
(
:pipeline
)
{
merge_request
.
head_pipeline
}
subject
{
merge_request
.
compare_accessibility_reports
}
context
'when head pipeline has accessibility reports'
do
let
(
:job
)
do
create
(
:ci_build
,
options:
{
artifacts:
{
reports:
{
pa11y:
[
'accessibility.json'
]
}
}
},
pipeline:
pipeline
)
end
let
(
:artifacts_metadata
)
{
create
(
:ci_job_artifact
,
:metadata
,
job:
job
)
}
context
'when reactive cache worker is parsing results asynchronously'
do
it
'returns parsing status'
do
expect
(
subject
[
:status
]).
to
eq
(
:parsing
)
end
end
context
'when reactive cache worker is inline'
do
before
do
synchronous_reactive_cache
(
merge_request
)
end
it
'returns parsed status'
do
expect
(
subject
[
:status
]).
to
eq
(
:parsed
)
expect
(
subject
[
:data
]).
to
be_present
end
context
'when an error occurrs'
do
before
do
merge_request
.
update!
(
head_pipeline:
nil
)
end
it
'returns an error status'
do
expect
(
subject
[
:status
]).
to
eq
(
:error
)
expect
(
subject
[
:status_reason
]).
to
eq
(
"This merge request does not have accessibility reports"
)
end
end
context
'when cached result is not latest'
do
before
do
allow_next_instance_of
(
Ci
::
CompareAccessibilityReportsService
)
do
|
service
|
allow
(
service
).
to
receive
(
:latest?
).
and_return
(
false
)
end
end
it
'raises an InvalidateReactiveCache error'
do
expect
{
subject
}.
to
raise_error
(
ReactiveCaching
::
InvalidateReactiveCache
)
end
end
end
end
end
describe
'#all_commit_shas'
do
describe
'#all_commit_shas'
do
context
'when merge request is persisted'
do
context
'when merge request is persisted'
do
let
(
:all_commit_shas
)
do
let
(
:all_commit_shas
)
do
...
...
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