vx-service_connector 0.2.18 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4d16845570b8f0a590c3a650df7a166125ceed3
4
- data.tar.gz: af38d8c131297173381eaf7665584c43a1cf567f
3
+ metadata.gz: 2e8860acc2f0b4675438cf042873da0c64299235
4
+ data.tar.gz: 8f782d34ded7d0742b70be0c24d7862e02e9fc9f
5
5
  SHA512:
6
- metadata.gz: 048f1d236438443d4b24515e9d3896df1e971ab40b03cead9341b293d56440abbaac66c984f743a2669bceb655d876da318c1ca5cceaec6d240490ef48275821
7
- data.tar.gz: a4c4faa4ff87610eca86bb38953aefb28f4d1fd612944339fbf58ae5949da282b3a6ee63250f93b8e5588ba1ee59f7d6ab32910b45130facac9aeae8dff83525
6
+ metadata.gz: aeced5f68311012be6e0c93c12c8bb79d0e21defc9e8841037dc181565c8bb4172537a4e988edf1623b6332042195e0763b582e1258851ea530dca54cb0236cf
7
+ data.tar.gz: d4910f9c35fc9af5a901174d16b625ad7d38d729610cc1e4324d337dbb530be737450ac1b1b19213f7d9e7c12f43ec4d9358d4161389f2825d41f1bcfc965263
@@ -21,7 +21,7 @@ module Vx
21
21
  private
22
22
 
23
23
  def pull_request?
24
- !key? 'repository'
24
+ !(key? 'repository') && pull_request
25
25
  end
26
26
 
27
27
  def pull_request_number
@@ -55,7 +55,7 @@ module Vx
55
55
  def web_url
56
56
  if pull_request?
57
57
  pull_request['links'] ? pull_request['links']['html']['href'] : nil
58
- else
58
+ elsif head_commit && params['repository']
59
59
  "https://bitbucket.org#{params['repository']['absolute_url']}commits/#{head_commit['raw_node']}"
60
60
  end
61
61
  end
@@ -77,7 +77,7 @@ module Vx
77
77
  end
78
78
 
79
79
  def commits?
80
- not params["commits"].empty?
80
+ params['commits'] && !(params['commits'].empty?)
81
81
  end
82
82
 
83
83
  def author_email
@@ -89,7 +89,11 @@ module Vx
89
89
  end
90
90
 
91
91
  def close_pull_request?
92
- pull_request? && (pull_request['state'] && %w(DECLINED MERGED).include?(pull_request['state']))
92
+ %w(DECLINED MERGED).include?(pull_request_state)
93
+ end
94
+
95
+ def pull_request_state
96
+ pull_request? and pull_request.is_a?(Hash) and pull_request['state']
93
97
  end
94
98
 
95
99
  def pull_request_head_repo_full_name
@@ -119,11 +123,13 @@ module Vx
119
123
  end
120
124
 
121
125
  def head_commit
122
- params['commits'].last || {}
126
+ ( params['commits'] && params['commits'].last ) || {}
123
127
  end
124
128
 
125
129
  def pull_request
126
- params.first.last
130
+ @pull_request ||= begin
131
+ params.first.last.is_a?(Hash) && params.first.last
132
+ end
127
133
  end
128
134
 
129
135
  def key?(name)
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module ServiceConnector
3
- VERSION = "0.2.18"
3
+ VERSION = "0.2.19"
4
4
  end
5
5
  end
@@ -0,0 +1,20 @@
1
+ {
2
+ "object_kind": "merge_request",
3
+ "object_attributes": {
4
+ "id": 579,
5
+ "target_branch": "master",
6
+ "source_branch": "1517-doku",
7
+ "source_project_id": 1,
8
+ "author_id": 6,
9
+ "assignee_id": 6,
10
+ "title": "1517 Doku",
11
+ "created_at": "2014-11-12T08:57:47.000Z",
12
+ "updated_at": "2014-11-12T09:22:08.114Z",
13
+ "milestone_id": null,
14
+ "state": "opened",
15
+ "merge_status": "unchecked",
16
+ "target_project_id": 1,
17
+ "iid": 579,
18
+ "description": ""
19
+ }
20
+ }
@@ -86,4 +86,11 @@ describe Vx::ServiceConnector::Bitbucket::Payload do
86
86
  its(:ignore?) { should be_true }
87
87
  end
88
88
 
89
+ context 'push with empty commits in PR' do
90
+
91
+ let(:content) { read_json_fixture 'bitbucket/payload/bug_2_empty_commits' }
92
+
93
+ its(:ignore?) { should be_true }
94
+ end
95
+
89
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-service_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2014-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -175,6 +175,7 @@ files:
175
175
  - spec/fixtures/bitbucket/deploy_keys.json
176
176
  - spec/fixtures/bitbucket/hooks.json
177
177
  - spec/fixtures/bitbucket/payload/bug_1_empty_commits.json
178
+ - spec/fixtures/bitbucket/payload/bug_2_empty_commits.json
178
179
  - spec/fixtures/bitbucket/payload/created_pull_request.json
179
180
  - spec/fixtures/bitbucket/payload/declined_pull_request.json
180
181
  - spec/fixtures/bitbucket/payload/foreign_pull_request.json
@@ -264,6 +265,7 @@ test_files:
264
265
  - spec/fixtures/bitbucket/deploy_keys.json
265
266
  - spec/fixtures/bitbucket/hooks.json
266
267
  - spec/fixtures/bitbucket/payload/bug_1_empty_commits.json
268
+ - spec/fixtures/bitbucket/payload/bug_2_empty_commits.json
267
269
  - spec/fixtures/bitbucket/payload/created_pull_request.json
268
270
  - spec/fixtures/bitbucket/payload/declined_pull_request.json
269
271
  - spec/fixtures/bitbucket/payload/foreign_pull_request.json