vx-service_connector 0.4.7 → 0.4.8

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: 3567c44011db3b375be8334b60e45419a7d9f668
4
- data.tar.gz: ad89accadaf465803640afc400cc3bb7be20ac9d
3
+ metadata.gz: 3bc6a731bfafa1b7dc6d09d2755a25c9bc848d29
4
+ data.tar.gz: 5f7881e330772635665700529c0f948d2f2f0c42
5
5
  SHA512:
6
- metadata.gz: 0dfb0cd5d8f3798f24fbd3005af60650444440bb2157544acd88654f9b4910252f16f11e2a8b2bd9efd00f727ecad6a4e47fe321621056b2835d830f8880d96a
7
- data.tar.gz: c91c3d991b0bb990f9d3f9adb5216c8fcffc9c84183761fbce9263ac7fcf30089cb7746941a919a82800db0759eb81be31323037ea0d0f667175d61bfcb592ea
6
+ metadata.gz: 14070ff3e02e5041cddc243c74a15263cae466dad0ee645ff2b2102e2bb087b4db2e74acf7c6f77e300d31ea2c217b0ce2b38d08ecfdfa0b5f13350c74422281
7
+ data.tar.gz: e94e996542f12a2cab47e0bf7b56586f880a2a2ed97be8364379e91bcdf8ed0f5f87a657af2f2d6d5ad541bd93e67a215fd9e02e6201722c8beeba1ff964f359
@@ -41,7 +41,7 @@ module Vx
41
41
  if restriction.nil?
42
42
  # skip internal pr or tag
43
43
  # allow all pushes and foreign pr
44
- return !tag?
44
+ return (!internal_pull_request? || !tag?)
45
45
  end
46
46
 
47
47
  if restriction.is_a?(Hash)
@@ -49,7 +49,10 @@ module Vx
49
49
  pr = restriction[:pull_request]
50
50
 
51
51
  if branch_re && Regexp.new(branch_re).match(branch)
52
- return true
52
+ # if branch name matches
53
+ # we're already building it,
54
+ # so we should ignore prs.
55
+ return !internal_pull_request?
53
56
  end
54
57
 
55
58
  if pr && pull_request?
@@ -65,11 +68,7 @@ module Vx
65
68
  end
66
69
 
67
70
  def ignore?
68
- !!(
69
- skip ||
70
- internal_pull_request? ||
71
- message.to_s =~ PAYLOAD_IGNORE_RE
72
- )
71
+ !!(skip || message.to_s =~ PAYLOAD_IGNORE_RE)
73
72
  end
74
73
 
75
74
  def tag?
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module ServiceConnector
3
- VERSION = "0.4.7"
3
+ VERSION = "0.4.8"
4
4
  end
5
5
  end
@@ -27,6 +27,28 @@ describe Vx::ServiceConnector::Bitbucket::Payload do
27
27
  its(:web_url) { should eq url }
28
28
  end
29
29
 
30
+
31
+ context 'create pull_request' do
32
+ let(:content) { read_json_fixture 'bitbucket/payload/created_pull_request' }
33
+ let(:url) { 'https://bitbucket.org/121111foobar/vx-promo/pull-request/1' }
34
+ let(:sha) { 'b14806535f5e' }
35
+
36
+ before do
37
+ mock_get_commit '121111foobar/vx-promo', sha
38
+ end
39
+
40
+ its(:ignore?) { should be_false }
41
+ its(:pull_request?) { should be_true }
42
+ its(:pull_request_number) { should eq 1 }
43
+ its(:branch) { should eq 'test' }
44
+ its(:branch_label) { should eq 'test' }
45
+ its(:sha) { should eq sha }
46
+ its(:message) { should eq 'Fix all the bugs' }
47
+ its(:author) { should eq 'login' }
48
+ its(:author_email) { should eq 'example@gmail.com' }
49
+ its(:web_url) { should eq url }
50
+ end
51
+
30
52
  context 'declined pull request' do
31
53
  let(:content) { read_json_fixture('bitbucket/payload/declined_pull_request') }
32
54
 
@@ -69,7 +91,7 @@ describe Vx::ServiceConnector::Bitbucket::Payload do
69
91
  mock_get_commit '121111foobar/vx-promo', 'b14806535f5e'
70
92
  end
71
93
 
72
- its(:ignore?) { should be_true }
94
+ its(:ignore?) { should be_false }
73
95
  end
74
96
 
75
97
  context 'push with empty commits' do
@@ -32,6 +32,29 @@ describe Vx::ServiceConnector::Github::Payload do
32
32
  its(:tag) { should be_nil }
33
33
  end
34
34
 
35
+ context "internal pull_request" do
36
+ let(:content) { read_json_fixture("github/payload/pull_request") }
37
+ let(:url) { "https://github.com/evrone/cybergifts/pull/177" }
38
+ let(:sha) { '84158c732ff1af3db9775a37a74ddc39f5c4078f' }
39
+
40
+ before do
41
+ mock_get_commit 'evrone/cybergifts', sha
42
+ end
43
+
44
+ its(:pull_request?) { should be_true }
45
+ its(:foreign_pull_request?) { should be_false }
46
+ its(:internal_pull_request?){ should be_true }
47
+ its(:pull_request_number) { should eq 177 }
48
+ its(:sha) { should eq sha }
49
+ its(:branch) { should eq 'test' }
50
+ its(:branch_label) { should eq 'dima-exe:test' }
51
+ its(:message) { should eq 'Fix all the bugs' }
52
+ its(:author) { should eq 'Monalisa Octocat' }
53
+ its(:author_email) { should eq 'support@github.com' }
54
+ its(:web_url) { should eq url }
55
+ its(:ignore?) { should be_false }
56
+ end
57
+
35
58
  context "Octokit exceptions" do
36
59
  let(:content) { read_json_fixture("github/payload/pull_request") }
37
60
  let(:url) { "https://github.com/evrone/cybergifts/pull/177" }
@@ -47,7 +47,7 @@ describe "(models)" do
47
47
  # deny, internal pr
48
48
  instance(
49
49
  params.merge(internal_pull_request?: true)
50
- ).to_not be_perform(nil)
50
+ ).to be_perform(nil)
51
51
  end
52
52
 
53
53
  it "restriction is hash" do
@@ -69,7 +69,21 @@ describe "(models)" do
69
69
  # pass, pr allowed
70
70
  instance(
71
71
  params.merge(internal_pull_request?: true)
72
- ).not_to be_perform(pull_request: true)
72
+ ).to be_perform(pull_request: true)
73
+
74
+ instance(
75
+ params.merge(
76
+ internal_pull_request?: true,
77
+ branch: '(develop)'
78
+ )
79
+ ).not_to be_perform(branch: '$\(dev')
80
+
81
+ instance(
82
+ params.merge(
83
+ internal_pull_request?: true,
84
+ branch: '(develop)'
85
+ )
86
+ ).to be_perform(branch: 'master', pull_request: true)
73
87
 
74
88
  # deny, pr not allowed
75
89
  instance(
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.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit