Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 03:09:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 03:09:33 +0300
commitb56027c9d80ac0e297ba8a43c81e8504172dbf9f (patch)
treeb85f743277145e930ae195664655d696e6e0a7fc /spec/controllers
parent7915c41e4261719719e791602c8235574157164c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/import/gitea_controller_spec.rb2
-rw-r--r--spec/controllers/projects/import/jira_controller_spec.rb29
2 files changed, 21 insertions, 10 deletions
diff --git a/spec/controllers/import/gitea_controller_spec.rb b/spec/controllers/import/gitea_controller_spec.rb
index b4834dffdb3..006b423ce5f 100644
--- a/spec/controllers/import/gitea_controller_spec.rb
+++ b/spec/controllers/import/gitea_controller_spec.rb
@@ -42,7 +42,7 @@ describe Import::GiteaController do
get :status, format: :json
expect(controller).to redirect_to(new_import_url)
- expect(flash[:alert]).to eq('Specified URL cannot be used.')
+ expect(flash[:alert]).to eq('Specified URL cannot be used: "Only allowed schemes are http, https"')
end
end
end
diff --git a/spec/controllers/projects/import/jira_controller_spec.rb b/spec/controllers/projects/import/jira_controller_spec.rb
index 33b51320391..f692f976bc0 100644
--- a/spec/controllers/projects/import/jira_controller_spec.rb
+++ b/spec/controllers/projects/import/jira_controller_spec.rb
@@ -93,18 +93,29 @@ describe Projects::Import::JiraController do
end
context 'post import' do
- it 'creates import state' do
- expect(project.import_state).to be_nil
+ 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: '' }
- post :import, params: { namespace_id: project.namespace, project_id: project, jira_project_key: 'Test' }
+ expect(response).to redirect_to(project_import_jira_path(project))
+ expect(flash[:alert]).to eq('No jira project key has been provided.')
+ end
+ end
- project.reload
+ context 'when everything is ok' do
+ it 'creates import state' do
+ expect(project.import_state).to be_nil
- jira_project = project.import_data.data.dig('jira', 'projects').first
- expect(project.import_type).to eq 'jira'
- expect(project.import_state.status).to eq 'scheduled'
- expect(jira_project['key']).to eq 'Test'
- expect(response).to redirect_to(project_import_jira_path(project))
+ post :import, params: { namespace_id: project.namespace, project_id: project, jira_project_key: 'Test' }
+
+ project.reload
+
+ jira_project = project.import_data.data.dig('jira', 'projects').first
+ expect(project.import_type).to eq 'jira'
+ expect(project.import_state.status).to eq 'scheduled'
+ expect(jira_project['key']).to eq 'Test'
+ expect(response).to redirect_to(project_import_jira_path(project))
+ end
end
end
end