Skip to content

Commit

Permalink
:fix: pr_json processed as Hash instead of String
Browse files Browse the repository at this point in the history
  • Loading branch information
juliendms committed Nov 6, 2020
1 parent 0b58962 commit 4a65866
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
danger-yajp (0.1.0)
danger-yajp (0.1.1)
danger-plugin-api
jira-ruby

Expand Down
2 changes: 1 addition & 1 deletion lib/yajp/gem_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Yajp
VERSION = '0.1.0'
VERSION = '0.1.1'
end
6 changes: 2 additions & 4 deletions lib/yajp/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,10 @@ def vcs_host
def pr_link
return @pr_link unless @pr_link.nil?

pr_hash = JSON.parse(vcs_host.pr_json, symbolize_names: true)

if defined? @dangerfile.gitlab
@pr_link = pr_hash[:web_url]
@pr_link = vcs_host.pr_json['web_url']
else
@pr_link = pr_hash[:html_url]
@pr_link = vcs_host.pr_json['html_url']
end

return @pr_link
Expand Down
2 changes: 1 addition & 1 deletion spec/yajp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def issue.find(key)

it 'can add remote link' do
pr_title = 'PR Title'
pr_json = '{"html_url":"https://github.com/test/pull/1234"}'
pr_json = { 'html_url' => 'https://github.com/test/pull/1234' }
url = "#{ENV['DANGER_JIRA_URL']}/rest/api/2/issue/WEB-134/remotelink"
json = File.read("#{File.dirname(__FILE__)}/support/remotelink.json")
issue = plugin.api.Issue.build
Expand Down

0 comments on commit 4a65866

Please sign in to comment.