From 9cbccb92effde25ea2d6e962006b24634c508e97 Mon Sep 17 00:00:00 2001 From: Peter Bell Date: Sat, 20 Jun 2020 10:39:56 +0100 Subject: [PATCH 1/7] This updates the REST API used to pull sprint details Was using Grasshopper. Switched to using the newer agile API. Ran all RSpecs and they pass. Does away with the need to query rapidView. --- lib/jira/resource/sprint.rb | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/jira/resource/sprint.rb b/lib/jira/resource/sprint.rb index 74beffd4..3ea7caf5 100644 --- a/lib/jira/resource/sprint.rb +++ b/lib/jira/resource/sprint.rb @@ -48,7 +48,7 @@ def get_sprint_details_attribute(attribute_name) def get_sprint_details search_url = - "#{client.options[:site]}#{client.options[:client_path]}/rest/greenhopper/1.0/rapid/charts/sprintreport?rapidViewId=#{rapidview_id}&sprintId=#{id}" + "#{client.options[:site]}#{client.options[:client_path]}/rest/agile/1.0/sprint/#{id}" begin response = client.get(search_url) rescue StandardError @@ -56,24 +56,12 @@ def get_sprint_details end json = self.class.parse_json(response.body) - @start_date = Date.parse(json['sprint']['startDate']) unless json['sprint']['startDate'] == 'None' - @end_date = Date.parse(json['sprint']['endDate']) unless json['sprint']['endDate'] == 'None' - @completed_date = Date.parse(json['sprint']['completeDate']) unless json['sprint']['completeDate'] == 'None' + @start_date = json['sprint']['startDate'] && Date.parse(json['sprint']['startDate']) + @end_date = json['sprint']['endDate'] && Date.parse(json['sprint']['endDate']) + @completed_date = json['sprint']['completeDate'] && Date.parse(json['sprint']['completeDate']) @sprint_report = client.SprintReport.build(json['contents']) end - def rapidview_id - return @attrs['rapidview_id'] if @attrs['rapidview_id'] - search_url = client.options[:site] + '/secure/GHGoToBoard.jspa?sprintId=' + id.to_s - begin - response = client.get(search_url) - rescue JIRA::HTTPError => error - return unless error.response.instance_of? Net::HTTPFound - rapid_view_match = /rapidView=(\d+)&/.match(error.response['location']) - @attrs['rapidview_id'] = rapid_view_match[1] unless rapid_view_match.nil? - end - end - def save(attrs = {}, _path = nil) attrs = @attrs if attrs.empty? super(attrs, agile_path) From 4404aaf671ce4ca10e8593093ee0d6ccb4fa579f Mon Sep 17 00:00:00 2001 From: Spike Ilacqua Date: Tue, 14 Feb 2023 09:14:28 -0700 Subject: [PATCH 2/7] Allow overriding Net::HTTP max_retries --- lib/jira/client.rb | 2 ++ lib/jira/http_client.rb | 1 + spec/jira/http_client_spec.rb | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/lib/jira/client.rb b/lib/jira/client.rb index b777766e..b1723e87 100644 --- a/lib/jira/client.rb +++ b/lib/jira/client.rb @@ -34,6 +34,7 @@ module JIRA # :default_headers => {}, # :use_client_cert => false, # :read_timeout => nil, + # :max_retries => nil, # :http_debug => false, # :shared_secret => nil, # :cert_path => nil, @@ -86,6 +87,7 @@ class Client :default_headers, :use_client_cert, :read_timeout, + :max_retries, :http_debug, :issuer, :base_url, diff --git a/lib/jira/http_client.rb b/lib/jira/http_client.rb index bdd89ea6..a021b7c4 100644 --- a/lib/jira/http_client.rb +++ b/lib/jira/http_client.rb @@ -59,6 +59,7 @@ def http_conn(uri) http_conn.verify_mode = @options[:ssl_verify_mode] http_conn.ssl_version = @options[:ssl_version] if @options[:ssl_version] http_conn.read_timeout = @options[:read_timeout] + http_conn.max_retries = @options[:max_retries] if @options[:max_retries] http_conn.ca_file = @options[:ca_file] if @options[:ca_file] http_conn end diff --git a/spec/jira/http_client_spec.rb b/spec/jira/http_client_spec.rb index e184ea67..abaa0ac7 100644 --- a/spec/jira/http_client_spec.rb +++ b/spec/jira/http_client_spec.rb @@ -69,6 +69,13 @@ JIRA::HttpClient.new(options) end + let(:basic_client_with_max_retries) do + options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS).merge( + max_retries: 2 + ) + JIRA::HttpClient.new(options) + end + let(:response) do response = double('response') allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(true) @@ -290,6 +297,21 @@ expect(client.http_conn(client.uri).ca_file).to eql('/opt/custom.ca.pem') end + it 'allows overriding max_retries' do + http_conn = double + uri = double + host = double + port = double + expect(uri).to receive(:host).and_return(host) + expect(uri).to receive(:port).and_return(port) + expect(Net::HTTP).to receive(:new).with(host, port).and_return(http_conn) + expect(http_conn).to receive(:use_ssl=).with(basic_client.options[:use_ssl]).and_return(http_conn) + expect(http_conn).to receive(:verify_mode=).with(basic_client.options[:ssl_verify_mode]).and_return(http_conn) + expect(http_conn).to receive(:read_timeout=).with(basic_client.options[:read_timeout]).and_return(http_conn) + expect(http_conn).to receive(:max_retries=).with(basic_client_with_max_retries.options[:max_retries]).and_return(http_conn) + expect(basic_client_with_max_retries.http_conn(uri)).to eq(http_conn) + end + it 'returns a http connection' do http_conn = double uri = double From af3f3a4928ea1859c054158c569fef1e1bef2f53 Mon Sep 17 00:00:00 2001 From: Robert Brodie Date: Sat, 27 Apr 2024 18:18:34 -0400 Subject: [PATCH 3/7] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 20 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..f57ef21c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,20 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: Bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +A runnable code example to reproduce the issue. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..f24e6f6e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: Feature +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context about the feature request here. From 96cc14428b50c8fac5284087515854074b0960c4 Mon Sep 17 00:00:00 2001 From: Robert Brodie Date: Sat, 27 Apr 2024 19:53:02 -0400 Subject: [PATCH 4/7] Create codeql.yml --- .github/workflows/codeql.yml | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..44aa3f48 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,100 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + paths-ignore: + - '**/*.md' + - 'http-basic-example.rb' + - 'example.rb' + pull_request: + branches: [ "master" ] + paths-ignore: + - '**/*.md' + - 'http-basic-example.rb' + - 'example.rb' + schedule: + - cron: '0 13 * * *' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: ruby + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From b482ed7bce3a92ce74bb92e2966d7c339c91324d Mon Sep 17 00:00:00 2001 From: Robert Brodie Date: Sat, 27 Apr 2024 22:47:45 -0400 Subject: [PATCH 5/7] #443 Resolve URI.open report --- lib/jira/resource/attachment.rb | 8 ++-- spec/jira/resource/attachment_spec.rb | 62 ++++++++++++++++----------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/lib/jira/resource/attachment.rb b/lib/jira/resource/attachment.rb index 9e58b132..a0d6b8b1 100644 --- a/lib/jira/resource/attachment.rb +++ b/lib/jira/resource/attachment.rb @@ -16,7 +16,7 @@ def self.endpoint_name end def self.meta(client) - response = client.get(client.options[:rest_base_path] + '/attachment/meta') + response = client.get("#{client.options[:rest_base_path]}/attachment/meta") parse_json(response.body) end @@ -42,7 +42,7 @@ def self.meta(client) # @yieldparam [IO] file The IO object streaming the download. def download_file(headers = {}, &block) default_headers = client.options[:default_headers] - URI.open(content, default_headers.merge(headers), &block) + URI.parse(content).open(default_headers.merge(headers), &block) end # Downloads the file contents as a string object. @@ -54,9 +54,7 @@ def download_file(headers = {}, &block) # @param [Hash] headers Any additional headers to call Jira. # @return [String,NilClass] The file contents. def download_contents(headers = {}) - download_file(headers) do |file| - file.read - end + download_file(headers, &:read) end def save!(attrs, path = url) diff --git a/spec/jira/resource/attachment_spec.rb b/spec/jira/resource/attachment_spec.rb index 13cf249d..a1783be9 100644 --- a/spec/jira/resource/attachment_spec.rb +++ b/spec/jira/resource/attachment_spec.rb @@ -3,9 +3,9 @@ describe JIRA::Resource::Attachment do subject(:attachment) do JIRA::Resource::Attachment.new( - client, - issue: JIRA::Resource::Issue.new(client), - attrs: { 'author' => { 'foo' => 'bar' } } + client, + issue: JIRA::Resource::Issue.new(client), + attrs: { 'author' => { 'foo' => 'bar' } } ) end @@ -39,8 +39,8 @@ let(:response) do double( - 'response', - body: '{"enabled":true,"uploadLimit":10485760}' + 'response', + body: '{"enabled":true,"uploadLimit":10485760}' ) end @@ -61,11 +61,10 @@ context 'there is an attachment on an issue' do let(:client) do - JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false ) + JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false) end let(:attachment_file_contents) { 'file contents' } - let(:file_target) { double(read: :attachment_file_contents) } - let(:attachment_url) { "https:jirahost/secure/attachment/32323/myfile.txt" } + let(:attachment_url) { 'https://localhost:2990/secure/attachment/32323/myfile.txt' } subject(:attachment) do JIRA::Resource::Attachment.new( client, @@ -74,24 +73,24 @@ ) end + before(:each) do + stub_request(:get, attachment_url).to_return(body: attachment_file_contents) + end + describe '.download_file' do it 'passes file object to block' do - expect(URI).to receive(:open).with(attachment_url, anything).and_yield(file_target) + expect(URI).to receive(:parse).with(attachment_url).and_call_original attachment.download_file do |file| - expect(file).to eq(file_target) + expect(file.read).to eq(attachment_file_contents) end - end end describe '.download_contents' do it 'downloads the file contents as a string' do - expect(URI).to receive(:open).with(attachment_url, anything).and_return(attachment_file_contents) - - result_str = attachment.download_contents - - expect(result_str).to eq(attachment_file_contents) + expect(URI).to receive(:parse).with(attachment_url).and_call_original + expect(attachment.download_contents).to eq(attachment_file_contents) end end end @@ -139,27 +138,34 @@ attrs: { 'author' => { 'foo' => 'bar' } } ) end - let(:default_headers_given) { { 'authorization' => "Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2" } } + let(:default_headers_given) { + { + 'authorization' => 'Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2' + } + } let(:bearer_client) do JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false, default_headers: default_headers_given ) end let(:merged_headers) do - {"Accept"=>"application/json", "X-Atlassian-Token"=>"nocheck"}.merge(default_headers_given) + { + 'Accept' => 'application/json', + 'X-Atlassian-Token' => 'nocheck' + }.merge(default_headers_given) end it 'passes the custom headers' do - expect(bearer_client.request_client).to receive(:request_multipart).with(anything, anything, merged_headers).and_return(response) + expect(bearer_client.request_client).to receive(:request_multipart) + .with(anything, anything, merged_headers) + .and_return(response) bearer_attachment.save('file' => path_to_file) - end end - end describe '#save!' do - subject { attachment.save!('file' => path_to_file) } + subject { attachment.save!('file' => path_to_file) } before do allow(client).to receive(:post_multipart).and_return(response) @@ -193,20 +199,24 @@ attrs: { 'author' => { 'foo' => 'bar' } } ) end - let(:default_headers_given) { { 'authorization' => "Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2" } } + let(:default_headers_given) { { 'authorization' => 'Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2' } } let(:bearer_client) do JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false, default_headers: default_headers_given ) end let(:merged_headers) do - {"Accept"=>"application/json", "X-Atlassian-Token"=>"nocheck"}.merge(default_headers_given) + { + 'Accept' => 'application/json', + 'X-Atlassian-Token' => 'nocheck' + }.merge(default_headers_given) end it 'passes the custom headers' do - expect(bearer_client.request_client).to receive(:request_multipart).with(anything, anything, merged_headers).and_return(response) + expect(bearer_client.request_client).to receive(:request_multipart) + .with(anything, anything, merged_headers) + .and_return(response) bearer_attachment.save!('file' => path_to_file) - end end end From 5d5dc6257d5d9f2897a0beee1c8d121b4f547e47 Mon Sep 17 00:00:00 2001 From: Robert Brodie Date: Sun, 28 Apr 2024 01:33:56 -0400 Subject: [PATCH 6/7] Add tests for sprints and fix complete_date --- lib/jira-ruby.rb | 1 - lib/jira/client.rb | 4 ---- lib/jira/resource/sprint.rb | 18 +++++++----------- lib/jira/resource/sprint_report.rb | 8 -------- spec/jira/resource/sprint_spec.rb | 27 ++++++++++++++++++--------- spec/mock_responses/sprint/1.json | 13 +++++++++++++ 6 files changed, 38 insertions(+), 33 deletions(-) delete mode 100644 lib/jira/resource/sprint_report.rb create mode 100644 spec/mock_responses/sprint/1.json diff --git a/lib/jira-ruby.rb b/lib/jira-ruby.rb index ae464f8e..addb96c6 100644 --- a/lib/jira-ruby.rb +++ b/lib/jira-ruby.rb @@ -32,7 +32,6 @@ require 'jira/resource/issue_picker_suggestions' require 'jira/resource/remotelink' require 'jira/resource/sprint' -require 'jira/resource/sprint_report' require 'jira/resource/resolution' require 'jira/resource/issue' require 'jira/resource/filter' diff --git a/lib/jira/client.rb b/lib/jira/client.rb index fa631050..d80fa754 100644 --- a/lib/jira/client.rb +++ b/lib/jira/client.rb @@ -232,10 +232,6 @@ def Sprint JIRA::Resource::SprintFactory.new(self) end - def SprintReport - JIRA::Resource::SprintReportFactory.new(self) - end - def ServerInfo JIRA::Resource::ServerInfoFactory.new(self) end diff --git a/lib/jira/resource/sprint.rb b/lib/jira/resource/sprint.rb index 6b90710b..5664c44c 100644 --- a/lib/jira/resource/sprint.rb +++ b/lib/jira/resource/sprint.rb @@ -12,26 +12,22 @@ def self.find(client, key) # get all issues of sprint def issues(options = {}) - jql = 'sprint = ' + id.to_s + jql = "sprint = #{id.to_s}" jql += " and updated >= '#{options[:updated]}'" if options[:updated] Issue.jql(client, jql) end def add_issue(issue) - add_issues( [ issue ]) + add_issues([issue]) end def add_issues(issues) - issue_ids = issues.map{ |issue| issue.id } + issue_ids = issues.map(&:id) request_body = { issues: issue_ids }.to_json client.post("#{agile_path}/issue", request_body) true end - def sprint_report - get_sprint_details_attribute('sprint_report') - end - def start_date get_sprint_details_attribute('start_date') end @@ -47,6 +43,7 @@ def complete_date def get_sprint_details_attribute(attribute_name) attribute = instance_variable_get("@#{attribute_name}") return attribute if attribute + get_sprint_details instance_variable_get("@#{attribute_name}") end @@ -61,10 +58,9 @@ def get_sprint_details end json = self.class.parse_json(response.body) - @start_date = json['sprint']['startDate'] && Date.parse(json['sprint']['startDate']) - @end_date = json['sprint']['endDate'] && Date.parse(json['sprint']['endDate']) - @completed_date = json['sprint']['completeDate'] && Date.parse(json['sprint']['completeDate']) - @sprint_report = client.SprintReport.build(json['contents']) + @start_date = json['startDate'] && Date.parse(json['startDate']) + @end_date = json['endDate'] && Date.parse(json['endDate']) + @complete_date = json['completeDate'] && Date.parse(json['completeDate']) end def save(attrs = {}, _path = nil) diff --git a/lib/jira/resource/sprint_report.rb b/lib/jira/resource/sprint_report.rb deleted file mode 100644 index 8f179229..00000000 --- a/lib/jira/resource/sprint_report.rb +++ /dev/null @@ -1,8 +0,0 @@ -module JIRA - module Resource - class SprintReportFactory < JIRA::BaseFactory # :nodoc: - end - - class SprintReport < JIRA::Base; end - end -end diff --git a/spec/jira/resource/sprint_spec.rb b/spec/jira/resource/sprint_spec.rb index b766abb8..ca57fd3c 100644 --- a/spec/jira/resource/sprint_spec.rb +++ b/spec/jira/resource/sprint_spec.rb @@ -2,12 +2,24 @@ describe JIRA::Resource::Sprint do let(:client) do - client = double(options: { site: 'https://foo.bar.com', context_path: '/jira' }) + client = double(options: { rest_base_path: '/jira/rest/api/2', context_path: '/jira' }) allow(client).to receive(:Sprint).and_return(JIRA::Resource::SprintFactory.new(client)) client end let(:sprint) { described_class.new(client) } - let(:agile_sprint_path) { "#{sprint.client.options[:context_path]}/rest/agile/1.0/sprint/#{sprint.id}" } + let(:agile_sprint_path) { "/jira/rest/agile/1.0/sprint/#{sprint.id}" } + let(:response) { double } + + describe 'get_sprint_details' do + let(:sprint) { JIRA::Resource::Sprint.find(client, '1') } + it 'check each of the date attributes' do + allow(client).to receive(:get).and_return(double(body: get_mock_response('sprint/1.json'))) + + expect(sprint.start_date).to eq Date.parse('2024-01-01T03:20:00.000Z') + expect(sprint.end_date).to eq Date.parse('2024-01-15T03:20:00.000Z') + expect(sprint.complete_date).to eq Date.parse('2024-01-16T03:48:00.000Z') + end + end describe '::find' do let(:response) { double('Response', body: '{"some_detail":"some detail"}') } @@ -91,7 +103,7 @@ let(:issue_id) { 1001 } let(:post_issue_path) do described_class.agile_path(client, sprint.id) - "/jira/rest/agile/1.0/sprint//issue" + '/jira/rest/agile/1.0/sprint//issue' end let(:issue) do issue = double @@ -99,13 +111,11 @@ issue end let(:post_issue_input) do - {"issues":[issue.id]} + { "issues": [issue.id] } end - describe '#add_issu' do context 'when an issue is passed' do - it 'posts with the issue id' do expect(client).to receive(:post).with(post_issue_path, post_issue_input.to_json) @@ -119,7 +129,7 @@ let(:issue_ids) { [ 1001, 1012 ] } let(:post_issue_path) do described_class.agile_path(client, sprint.id) - "/jira/rest/agile/1.0/sprint//issue" + '/jira/rest/agile/1.0/sprint//issue' end let(:issues) do issue_ids.map do |issue_id| @@ -129,12 +139,11 @@ end end let(:post_issue_input) do - {"issues": issue_ids} + { "issues": issue_ids } end describe '#add_issues' do context 'when an issue is passed' do - it 'posts with the issue id' do expect(client).to receive(:post).with(post_issue_path, post_issue_input.to_json) diff --git a/spec/mock_responses/sprint/1.json b/spec/mock_responses/sprint/1.json new file mode 100644 index 00000000..4fcb02df --- /dev/null +++ b/spec/mock_responses/sprint/1.json @@ -0,0 +1,13 @@ +{ + "id": 1, + "self": "https://localhost:2990/jira/rest/agile/1.0/sprint/1", + "state": "closed", + "name": "SP Sprint 1", + "startDate": "2024-01-01T03:20:00.000Z", + "endDate": "2024-01-15T03:20:00.000Z", + "completeDate": "2024-01-16T03:48:00.000Z", + "createdDate": "2024-01-01T00:00:00.000Z", + "originBoardId": 1, + "goal": "", + "rapidview_id": 1 +} \ No newline at end of file From 1373c9c9ff510c6a38794e13ab34a8b8b38a1ce9 Mon Sep 17 00:00:00 2001 From: Robert Brodie Date: Sun, 28 Apr 2024 02:25:20 -0400 Subject: [PATCH 7/7] Bump version to prepare for the next release --- lib/jira/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jira/version.rb b/lib/jira/version.rb index 09231406..afd85d02 100644 --- a/lib/jira/version.rb +++ b/lib/jira/version.rb @@ -1,3 +1,3 @@ module JIRA - VERSION = '2.3.0'.freeze + VERSION = '3.0.0'.freeze end