pact_broker 1.11.0 → 1.11.1

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: 5f09781dc3499bf4830479db69b58d8d26436bea
4
- data.tar.gz: 74c433ce40b144bd5e2c1cef5efa4a3d892a94f5
3
+ metadata.gz: a2e789a7f93e0c406d9a7fddda930d8a226098aa
4
+ data.tar.gz: 17f764538b78147ee4c2a7fe7546e799b58bd98e
5
5
  SHA512:
6
- metadata.gz: 85c3c79444957b05bcfd754e5d12b69a2d8196439a45e1f6ce1edaf2d2936e850f9656bbb3396d243434bd80a11a659a257b2614b10385c52e5a07b7b14fcfa1
7
- data.tar.gz: 78782d8518d1bf357c9d434b5ed40d77d6ab83f6f73745e063f22a2f5c747e61f65201af92851206c4b70cdab532d6d51a5d05a8d72cfbd25dfec0834723d80c
6
+ metadata.gz: 786b010b045b1b380f67eceeb0e5a0dbf4689d3daeb52a1445cd9d0cbca7462ce1a219fc39fd47d17da41c631e479690be99f2be051a49fff1d5aa8ab22a8caa
7
+ data.tar.gz: 2d6b77c90a5ac7d27b7034dd065ebc7dc8005ec4f008010c75434e73ce93d687416238fd17a8971bfd18b439813208516f0b1a26e4d6ebae116fcbc7253ae7e8
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.8
5
- - 2.2.4
3
+ - 2.1.10
4
+ - 2.2.5
6
5
  - 2.3.1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@ Do this to generate your change history
2
2
 
3
3
  $ git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
4
4
 
5
+ #### 1.11.1 (2016-10-13)
6
+ * 14381ac - Fix issue #59 Error when executing web hook with body. (Beth Skurrie, Thu Oct 13 12:50:17 2016 +1100)
5
7
 
6
8
  #### 1.11.0 (2016-08-13)
7
9
  * 18ffc4a - Add conflict guards to pact merger (Steve Pletcher, Fri Aug 5 12:31:30 2016 -0400)
data/RELEASING.md CHANGED
@@ -8,6 +8,7 @@
8
8
  3. Add files to git
9
9
 
10
10
  $ git add CHANGELOG.md lib/pact_broker/version.rb
11
+ $ git commit -m "Releasing version X.Y.Z"
11
12
 
12
13
  3. Release:
13
14
 
data/config.ru CHANGED
@@ -5,7 +5,7 @@ require 'rack/hal_browser'
5
5
  require 'pact_broker/ui/controllers/relationships'
6
6
 
7
7
 
8
- use Rack::Static, :urls => ["/stylesheets", "/css", "/fonts", "/js", "/javascripts"], :root => "public"
8
+ use Rack::Static, :urls => ["/stylesheets", "/css", "/fonts", "/js", "/javascripts", "/images"], :root => "public"
9
9
  use Rack::HalBrowser::Redirect, :exclude => ['/diagnostic', '/trace','/index']
10
10
 
11
11
  run Rack::URLMap.new(
@@ -56,7 +56,13 @@ module PactBroker
56
56
 
57
57
  req.basic_auth(username, password) if username
58
58
 
59
- req.body = body
59
+ unless body.nil?
60
+ if String === body
61
+ req.body = body
62
+ else
63
+ req.body = body.to_json
64
+ end
65
+ end
60
66
 
61
67
  logger.info "Making webhook request #{to_s}"
62
68
  response = Net::HTTP.start(uri.hostname, uri.port,
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '1.11.0'
2
+ VERSION = '1.11.1'
3
3
  end
@@ -11,6 +11,7 @@ module PactBroker
11
11
  let(:username) { nil }
12
12
  let(:password) { nil }
13
13
  let(:url) { 'http://example.org/hook' }
14
+ let(:body) { 'body' }
14
15
 
15
16
  subject do
16
17
  WebhookRequest.new(
@@ -19,7 +20,7 @@ module PactBroker
19
20
  headers: {'Content-type' => 'text/plain'},
20
21
  username: username,
21
22
  password: password,
22
- body: 'body')
23
+ body: body)
23
24
  end
24
25
 
25
26
  describe "description" do
@@ -103,6 +104,36 @@ module PactBroker
103
104
  end
104
105
  end
105
106
 
107
+ context "when the request has a JSONable body" do
108
+ let(:body) { [{"some": "json"}] }
109
+
110
+ let!(:http_request) do
111
+ stub_request(:post, "http://example.org/hook").
112
+ with(:headers => {'Content-Type'=>'text/plain'}, :body => body.to_json).
113
+ to_return(:status => 302, :body => "respbod", :headers => {'Content-Type' => 'text/plain, blah'})
114
+ end
115
+
116
+ it "converts the body to JSON before submitting the request" do
117
+ subject.execute
118
+ expect(http_request).to have_been_made
119
+ end
120
+ end
121
+
122
+ context "when the request has a nil body" do
123
+ let(:body) { nil }
124
+
125
+ let!(:http_request) do
126
+ stub_request(:post, "http://example.org/hook").
127
+ with(:headers => {'Content-Type'=>'text/plain'}, :body => nil).
128
+ to_return(:status => 302, :body => "respbod", :headers => {'Content-Type' => 'text/plain, blah'})
129
+ end
130
+
131
+ it "executes the request without a body" do
132
+ subject.execute
133
+ expect(http_request).to have_been_made
134
+ end
135
+ end
136
+
106
137
  context "when the request is successful" do
107
138
  it "returns a WebhookExecutionResult with success=true" do
108
139
  expect(subject.execute.success?).to be true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-12 00:00:00.000000000 Z
13
+ date: 2016-10-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty