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
36eca577
Commit
36eca577
authored
Apr 03, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if jira project key has been provided
parent
345156aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
11 deletions
+28
-11
app/controllers/projects/import/jira_controller.rb
app/controllers/projects/import/jira_controller.rb
+8
-2
spec/controllers/projects/import/jira_controller_spec.rb
spec/controllers/projects/import/jira_controller_spec.rb
+20
-9
No files found.
app/controllers/projects/import/jira_controller.rb
View file @
36eca577
...
@@ -22,8 +22,14 @@ module Projects
...
@@ -22,8 +22,14 @@ module Projects
end
end
def
import
def
import
response
=
::
JiraImport
::
StartImportService
.
new
(
current_user
,
@project
,
jira_import_params
[
:jira_project_key
]).
execute
jira_project_key
=
jira_import_params
[
:jira_project_key
]
if
jira_project_key
.
present?
response
=
::
JiraImport
::
StartImportService
.
new
(
current_user
,
@project
,
jira_project_key
).
execute
flash
[
:notice
]
=
response
.
message
if
response
.
message
.
present?
flash
[
:notice
]
=
response
.
message
if
response
.
message
.
present?
else
flash
[
:alert
]
=
'No jira project key has been provided.'
end
redirect_to
project_import_jira_path
(
@project
)
redirect_to
project_import_jira_path
(
@project
)
end
end
...
...
spec/controllers/projects/import/jira_controller_spec.rb
View file @
36eca577
...
@@ -93,6 +93,16 @@ describe Projects::Import::JiraController do
...
@@ -93,6 +93,16 @@ describe Projects::Import::JiraController do
end
end
context
'post import'
do
context
'post import'
do
context
'when jira project key is empty'
do
it
'redirects back to show with an error'
do
post
:import
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
jira_project_key:
''
}
expect
(
response
).
to
redirect_to
(
project_import_jira_path
(
project
))
expect
(
flash
[
:alert
]).
to
eq
(
'No jira project key has been provided.'
)
end
end
context
'when everything is ok'
do
it
'creates import state'
do
it
'creates import state'
do
expect
(
project
.
import_state
).
to
be_nil
expect
(
project
.
import_state
).
to
be_nil
...
@@ -108,6 +118,7 @@ describe Projects::Import::JiraController do
...
@@ -108,6 +118,7 @@ describe Projects::Import::JiraController do
end
end
end
end
end
end
end
context
'when import state is scheduled'
do
context
'when import state is scheduled'
do
let_it_be
(
:import_state
)
{
create
(
:import_state
,
project:
project
,
status: :scheduled
)
}
let_it_be
(
:import_state
)
{
create
(
:import_state
,
project:
project
,
status: :scheduled
)
}
...
...
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