summaryrefslogtreecommitdiff
path: root/spec/services/jira/requests
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/services/jira/requests
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/services/jira/requests')
-rw-r--r--spec/services/jira/requests/projects/list_service_spec.rb (renamed from spec/services/jira/requests/projects_spec.rb)22
1 files changed, 5 insertions, 17 deletions
diff --git a/spec/services/jira/requests/projects_spec.rb b/spec/services/jira/requests/projects/list_service_spec.rb
index f7b9aa7c00c..51e67dd821d 100644
--- a/spec/services/jira/requests/projects_spec.rb
+++ b/spec/services/jira/requests/projects/list_service_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Jira::Requests::Projects do
+RSpec.describe Jira::Requests::Projects::ListService do
let(:jira_service) { create(:jira_service) }
let(:params) { {} }
@@ -32,14 +32,6 @@ describe Jira::Requests::Projects do
end
context 'with jira_service' do
- context 'when limit is invalid' do
- let(:params) { { limit: 0 } }
-
- it 'returns a paylod with no projects returned' do
- expect(subject.payload[:projects]).to be_empty
- end
- end
-
context 'when validations and params are ok' do
let(:client) { double(options: { site: 'https://jira.example.com' }) }
@@ -60,7 +52,7 @@ describe Jira::Requests::Projects do
context 'when the request does not return any values' do
before do
- expect(client).to receive(:get).and_return({ 'someKey' => 'value' })
+ expect(client).to receive(:get).and_return([])
end
it 'returns a paylod with no projects returned' do
@@ -74,19 +66,15 @@ describe Jira::Requests::Projects do
context 'when the request returns values' do
before do
- expect(client).to receive(:get).and_return(
- { 'values' => %w(project1 project2), 'isLast' => false }
- )
- expect(JIRA::Resource::Project).to receive(:build).with(client, 'project1').and_return('jira_project1')
- expect(JIRA::Resource::Project).to receive(:build).with(client, 'project2').and_return('jira_project2')
+ expect(client).to receive(:get).and_return([{ "key" => 'project1' }, { "key" => 'project2' }])
end
it 'returns a paylod with jira projets' do
payload = subject.payload
expect(subject.success?).to be_truthy
- expect(payload[:projects]).to eq(%w(jira_project1 jira_project2))
- expect(payload[:is_last]).to be_falsey
+ expect(payload[:projects].map(&:key)).to eq(%w(project1 project2))
+ expect(payload[:is_last]).to be_truthy
end
end
end