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
48cfe985
Commit
48cfe985
authored
Aug 11, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use nested params for issue_type
- Update specs - Add js spec
parent
9c44696e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
9 deletions
+22
-9
app/assets/javascripts/incidents/components/incidents_list.vue
...ssets/javascripts/incidents/components/incidents_list.vue
+1
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+11
-2
spec/frontend/incidents/components/incidents_list_spec.js
spec/frontend/incidents/components/incidents_list_spec.js
+7
-2
spec/services/issues/build_service_spec.rb
spec/services/issues/build_service_spec.rb
+2
-2
No files found.
app/assets/javascripts/incidents/components/incidents_list.vue
View file @
48cfe985
...
...
@@ -183,7 +183,7 @@ export default {
return
mergeUrlParams
(
{
issuable_template
:
this
.
incidentTemplateName
,
issue_type
:
this
.
incidentType
,
'
issue[issue_type]
'
:
this
.
incidentType
,
},
this
.
newIssuePath
,
);
...
...
app/controllers/projects/issues_controller.rb
View file @
48cfe985
...
...
@@ -93,8 +93,7 @@ class Projects::IssuesController < Projects::ApplicationController
build_params
=
issue_params
.
merge
(
merge_request_to_resolve_discussions_of:
params
[
:merge_request_to_resolve_discussions_of
],
discussion_to_resolve:
params
[
:discussion_to_resolve
],
confidential:
!!
Gitlab
::
Utils
.
to_boolean
(
params
[
:issue
][
:confidential
]),
issue_type:
params
[
:issue_type
]
confidential:
!!
Gitlab
::
Utils
.
to_boolean
(
params
[
:issue
][
:confidential
])
)
service
=
Issues
::
BuildService
.
new
(
project
,
current_user
,
build_params
)
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
48cfe985
...
...
@@ -181,10 +181,11 @@ RSpec.describe Projects::IssuesController do
project
.
add_developer
(
user
)
end
it
'builds a new issue'
do
it
'builds a new issue'
,
:aggregate_failures
do
get
:new
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
assigns
(
:issue
)).
to
be_a_new
(
Issue
)
expect
(
assigns
(
:issue
).
issue_type
).
to
eq
(
'issue'
)
end
where
(
:conf_value
,
:conf_result
)
do
...
...
@@ -218,7 +219,7 @@ RSpec.describe Projects::IssuesController do
let
(
:issue_type
)
{
'issue'
}
before
do
get
:new
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
issue
_type:
issue_type
}
get
:new
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
issue
:
{
issue_type:
issue_type
}
}
end
subject
{
assigns
(
:issue
).
issue_type
}
...
...
@@ -1067,6 +1068,14 @@ RSpec.describe Projects::IssuesController do
project
.
issues
.
first
end
it
'creates the issue successfully'
,
:aggregate_failures
do
issue
=
post_new_issue
expect
(
issue
).
to
be_a
(
Issue
)
expect
(
issue
.
persisted?
).
to
eq
(
true
)
expect
(
issue
.
issue_type
).
to
eq
(
'issue'
)
end
context
'resolving discussions in MergeRequest'
do
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
).
to_discussion
}
let
(
:merge_request
)
{
discussion
.
noteable
}
...
...
spec/frontend/incidents/components/incidents_list_spec.js
View file @
48cfe985
...
...
@@ -10,7 +10,7 @@ import {
GlTabs
,
GlBadge
,
}
from
'
@gitlab/ui
'
;
import
{
visitUrl
,
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
{
visitUrl
,
joinPaths
,
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
import
IncidentsList
from
'
~/incidents/components/incidents_list.vue
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
{
I18N
,
INCIDENT_STATUS_TABS
}
from
'
~/incidents/constants
'
;
...
...
@@ -169,8 +169,13 @@ describe('Incidents List', () => {
});
});
it
(
'
shows the button linking to new incidents page with prefilled incident template
'
,
()
=>
{
it
(
'
shows the button linking to new incidents page with prefilled incident template
when clicked
'
,
()
=>
{
expect
(
findCreateIncidentBtn
().
exists
()).
toBe
(
true
);
findCreateIncidentBtn
().
trigger
(
'
click
'
);
expect
(
mergeUrlParams
).
toHaveBeenCalledWith
(
{
issuable_template
:
incidentTemplateName
,
'
issue[issue_type]
'
:
incidentType
},
newIssuePath
,
);
});
it
(
'
sets button loading on click
'
,
()
=>
{
...
...
spec/services/issues/build_service_spec.rb
View file @
48cfe985
...
...
@@ -149,13 +149,13 @@ RSpec.describe Issues::BuildService do
end
context
'with optional params'
do
it
'sets the
params
on the issue'
do
it
'sets the
issue_type
on the issue'
do
issue
=
build_issue
(
issue_type:
'incident'
)
expect
(
issue
.
issue_type
).
to
eq
(
'incident'
)
end
it
'
rejects the param if
nil'
do
it
'
defaults to issue if issue_type
nil'
do
issue
=
build_issue
(
issue_type:
nil
)
expect
(
issue
.
issue_type
).
to
eq
(
'issue'
)
...
...
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