danger-jira_sync 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fce89991967105fa855239f168ddcd39023c05f3a864602c0f73d625fdcf182
4
- data.tar.gz: add9884c0ce2306212d0ac502cf20b1ab9f3d1c70d25b1ec14fa884aba97b881
3
+ metadata.gz: 3676486d775890e8168b4c19fcb0723753c638abc1bbf234c305a389fcc74ac3
4
+ data.tar.gz: 29a78685c72621bc10e6100a9606e9c674e8d7e6e3858a23f77078e4f049f18c
5
5
  SHA512:
6
- metadata.gz: f9e4d1cf4d8409f002d014e10ab3dabf0c0932c31171b24d3f0b92cb0e6772980ede2f405358cb1cb9ab4c089f9f73e793e76134b91efd4906979c6d91bf2f8a
7
- data.tar.gz: e5403bd45a24ff908279a7e4c0f4d3397531318bd87fcca8b5ae2288d33d8fcea9a3eaadf38636789475d3fedb6023f7c1efb9ec5bf4556eb3c585820515aef2
6
+ metadata.gz: 5779baee09ceb623ccd21a4adf03b4621f4e119c84321095bd2ee59c8fdcbdbf9651e41f51a24350acccfb8adbb134c82dd0dc13974b640bb0d69cc0955e0ed2
7
+ data.tar.gz: 77208ea90084bcb5da9e548001db1f4a777cf55eb4d2ec6f8e45125427bd8c1c267744443447d7199870381e6bb9b6af380c482b1df918588f436bc505bdc1b5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-jira_sync (0.0.4)
4
+ danger-jira_sync (0.0.5)
5
5
  danger-plugin-api (~> 1.0)
6
6
  jira-ruby (~> 1.5.0)
7
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JiraSync
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
@@ -92,7 +92,7 @@ module Danger
92
92
  end
93
93
 
94
94
  def github_labels
95
- @github_labels ||= github.api.labels(repo)
95
+ @github_labels ||= github.api.labels(repo).map { |github_label| github_label[:name] }
96
96
  rescue Octokit::Error => e
97
97
  warn "#{e.response_status} Error while retrieving GitHub labels: #{e.message}"
98
98
  end
@@ -130,8 +130,21 @@ RSpec.describe Danger::DangerJiraSync do
130
130
  plugin.configure(jira_settings)
131
131
  end
132
132
 
133
+ def github_labels_response(labels)
134
+ labels.map do |label|
135
+ {
136
+ id: SecureRandom.random_number(100_000),
137
+ node_id: SecureRandom.base64,
138
+ url: "https://api.github.com/repos/<someorg>/<somerepo>/labels/#{label}",
139
+ name: label,
140
+ color: SecureRandom.hex(3),
141
+ default: false
142
+ }
143
+ end
144
+ end
145
+
133
146
  def stub_github_api_labelling(labels: [])
134
- allow(github_api_mock).to receive(:labels).and_return(labels)
147
+ allow(github_api_mock).to receive(:labels).and_return(github_labels_response(labels))
135
148
  allow(github_api_mock).to receive(:add_label).and_return(nil)
136
149
  allow(github_api_mock).to receive(:add_labels_to_an_issue).and_return(nil)
137
150
 
@@ -278,7 +291,7 @@ RSpec.describe Danger::DangerJiraSync do
278
291
  expect(dangerfile.status_report[:warnings].count).to eq(expected_missing_label_count)
279
292
  end
280
293
 
281
- it "creates a warning when it cannot fetch existing github labels" do
294
+ it "creates a warning when it cannot add a label to an existing github issue" do
282
295
  stub_github_api_labelling
283
296
 
284
297
  error = Octokit::Error.from_response({
@@ -299,7 +312,7 @@ RSpec.describe Danger::DangerJiraSync do
299
312
  expect(dangerfile.status_report[:warnings].count).to eq(1)
300
313
  end
301
314
 
302
- it "creates a warning when it cannot add a label to an existing github issue" do
315
+ it "creates a warning when it cannot fetch existing github labels" do
303
316
  stub_github_api_labelling
304
317
 
305
318
  error = Octokit::Error.from_response({
@@ -314,7 +327,7 @@ RSpec.describe Danger::DangerJiraSync do
314
327
  HEREDOC
315
328
  })
316
329
 
317
- expect(github_api_mock).to receive(:add_label).and_raise(error)
330
+ expect(github_api_mock).to receive(:labels).and_raise(error)
318
331
  expect(dangerfile.status_report[:warnings].count).to eq(0), "preconditions"
319
332
 
320
333
  VCR.use_cassette(:default_success, record: :new_episodes) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-jira_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Menesini