summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 21:09:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 21:09:56 +0000
commitc1a50b8195f4e36fda9b233acbde57a449bcf6c3 (patch)
treeb24a10a7951e9a799397753d1badf6894fe03089 /spec/controllers
parentb6847c621ff246e6abceb90545d5a608318762d6 (diff)
downloadgitlab-ce-c1a50b8195f4e36fda9b233acbde57a449bcf6c3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/import/jira_controller_spec.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/controllers/projects/import/jira_controller_spec.rb b/spec/controllers/projects/import/jira_controller_spec.rb
index 3a29c3d4093..33b51320391 100644
--- a/spec/controllers/projects/import/jira_controller_spec.rb
+++ b/spec/controllers/projects/import/jira_controller_spec.rb
@@ -66,13 +66,29 @@ describe Projects::Import::JiraController do
context 'when running jira import first time' do
context 'get show' do
- it 'renders show template' do
- allow(JIRA::Resource::Project).to receive(:all).and_return([])
+ before do
+ allow(JIRA::Resource::Project).to receive(:all).and_return(jira_projects)
+
expect(project.import_state).to be_nil
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
+ end
+
+ context 'when no projects have been retrieved from Jira' do
+ let(:jira_projects) { [] }
+
+ it 'render an error message' do
+ expect(flash[:alert]).to eq('No projects have been returned from Jira. Please check your Jira configuration.')
+ expect(response).to render_template(:show)
+ end
+ end
+
+ context 'when everything is ok' do
+ let(:jira_projects) { [double(name: 'FOO project', key: 'FOO')] }
- expect(response).to render_template :show
+ it 'renders show template' do
+ expect(response).to render_template(:show)
+ end
end
end