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
5793caac
Commit
5793caac
authored
May 08, 2020
by
Maxime Orefice
Committed by
Mayra Cabrera
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add has_accessibility_reports to MergeRequest
parent
f2f74407
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
app/models/merge_request.rb
app/models/merge_request.rb
+6
-0
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+12
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+26
-0
No files found.
app/models/merge_request.rb
View file @
5793caac
...
...
@@ -1300,6 +1300,12 @@ class MergeRequest < ApplicationRecord
compare_reports
(
Ci
::
CompareTestReportsService
)
end
def
has_accessibility_reports?
return
false
unless
Feature
.
enabled?
(
:accessibility_report_view
,
project
)
actual_head_pipeline
.
present?
&&
actual_head_pipeline
.
has_reports?
(
Ci
::
JobArtifact
.
accessibility_reports
)
end
def
has_coverage_reports?
return
false
unless
Feature
.
enabled?
(
:coverage_report_view
,
project
)
...
...
spec/factories/merge_requests.rb
View file @
5793caac
...
...
@@ -121,6 +121,18 @@ FactoryBot.define do
end
end
trait
:with_accessibility_reports
do
after
(
:build
)
do
|
merge_request
|
merge_request
.
head_pipeline
=
build
(
:ci_pipeline
,
:success
,
:with_accessibility_reports
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
)
end
end
trait
:with_coverage_reports
do
after
(
:build
)
do
|
merge_request
|
merge_request
.
head_pipeline
=
build
(
...
...
spec/models/merge_request_spec.rb
View file @
5793caac
...
...
@@ -1612,6 +1612,32 @@ describe MergeRequest do
end
end
describe
'#has_accessibility_reports?'
do
subject
{
merge_request
.
has_accessibility_reports?
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'when head pipeline has an accessibility reports'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
:with_accessibility_reports
,
source_project:
project
)
}
it
{
is_expected
.
to
be_truthy
}
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
accessibility_report_view:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when head pipeline does not have accessibility reports'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
it
{
is_expected
.
to
be_falsey
}
end
end
describe
'#has_coverage_reports?'
do
subject
{
merge_request
.
has_coverage_reports?
}
...
...
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