pact_broker-client 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@ Do this to generate your change history
2
2
 
3
3
  $ git log --date=relative --pretty=format:' * %h - %s (%an, %ad)' 'package/pact_broker-client-0.0.PRODVERSION'..'package/pact_broker-client-0.0.NEWVERSION'
4
4
 
5
+ #### 0.0.4 (2013-11-15)
6
+
7
+ * cf33479 - Merge branch 'master' of github.com:bethesque/pact_broker-client (Beth, 20 hours ago)
8
+ * 01087ae - Fixed problem where PublicationTask block was evaluated at load time, instead of run time. (Beth, 20 hours ago)
9
+ * 2073234 - Updating to use example.org as the base URL (Beth, 2 days ago)
10
+ * 07073de - Updating latest pact URL (Beth, 2 days ago)
11
+
5
12
  #### 0.0.3 (2013-11-13)
6
13
 
7
14
  * a3488bd - Fixing application/json+hal to application/hal+json (Beth, 2 days ago)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pact_broker-client (0.0.3)
4
+ pact_broker-client (0.0.5)
5
5
  httparty
6
6
  json
7
7
  pact
@@ -11,16 +11,7 @@ GEM
11
11
  specs:
12
12
  awesome_print (1.1.0)
13
13
  coderay (1.0.9)
14
- columnize (0.3.6)
15
- daemons (1.1.9)
16
- debugger (1.6.2)
17
- columnize (>= 0.3.1)
18
- debugger-linecache (~> 1.2.0)
19
- debugger-ruby_core_source (~> 1.2.3)
20
- debugger-linecache (1.2.0)
21
- debugger-ruby_core_source (1.2.3)
22
14
  diff-lcs (1.2.5)
23
- eventmachine (1.0.3)
24
15
  fakefs (0.4.2)
25
16
  find_a_port (1.0.1)
26
17
  httparty (0.12.0)
@@ -29,15 +20,15 @@ GEM
29
20
  json (1.8.1)
30
21
  method_source (0.8.2)
31
22
  multi_xml (0.5.5)
32
- pact (1.0.20)
23
+ pact (1.0.23)
33
24
  awesome_print (~> 1.1.0)
34
25
  find_a_port (~> 1.0.1)
35
26
  json
36
27
  rack-test (~> 0.6.2)
37
28
  randexp (~> 0.1.7)
38
29
  rspec (~> 2.12)
39
- thin
40
30
  thor
31
+ webrick
41
32
  pry (0.9.12.2)
42
33
  coderay (~> 1.0.5)
43
34
  method_source (~> 0.8)
@@ -58,17 +49,13 @@ GEM
58
49
  rspec (~> 2.11)
59
50
  rspec-mocks (2.14.4)
60
51
  slop (3.4.6)
61
- thin (1.6.1)
62
- daemons (>= 1.0.9)
63
- eventmachine (>= 1.0.0)
64
- rack (>= 1.0.0)
65
52
  thor (0.18.1)
53
+ webrick (1.3.1)
66
54
 
67
55
  PLATFORMS
68
56
  ruby
69
57
 
70
58
  DEPENDENCIES
71
- debugger
72
59
  fakefs (~> 0.4)
73
60
  pact_broker-client!
74
61
  pry
@@ -25,14 +25,14 @@ module PactBroker
25
25
  end
26
26
  end
27
27
 
28
- def latest
28
+ def list_latest
29
29
  response = self.class.get("/pacts/latest", headers: default_get_headers)
30
30
  handle_response(response) do
31
31
  map_pact_list_do_hash JSON.parse(response.body)["pacts"]
32
32
  end
33
33
  end
34
34
 
35
- def last options
35
+ def latest options
36
36
  url = get_latest_consumer_contract_url(options)
37
37
  response = self.class.get(url, headers: default_get_headers)
38
38
  handle_response(response) do
@@ -59,7 +59,7 @@ module PactBroker
59
59
  end
60
60
  end
61
61
 
62
- def find_last_consumer_contract_query options
62
+ def find_latest_consumer_contract_query options
63
63
  query = {:consumer => options[:consumer], :provider => options[:provider]}
64
64
  query[:tag] = options[:tag] if options[:tag]
65
65
  query
@@ -17,22 +17,22 @@ module PactBroker
17
17
 
18
18
  attr_accessor :pattern, :pact_broker_base_url, :consumer_version
19
19
 
20
- def initialize name = nil
20
+ def initialize name = nil, &block
21
21
  @name = name
22
22
  @pattern = 'spec/pacts/*.json'
23
23
  @pact_broker_base_url = 'http://pact-broker'
24
- yield self
25
- rake_task
24
+ rake_task &block
26
25
  end
27
26
 
28
27
  private
29
28
 
30
- def rake_task
29
+ def rake_task &block
31
30
  namespace :pact do
32
31
  desc "Publish pacts to pact broker"
33
32
  task task_name do
33
+ block.call(self)
34
34
  require 'pact_broker/client/publish_pacts'
35
- success = PactBroker::Client::PublishPacts.new(pact_broker_base_url, FileList[@pattern], consumer_version).call
35
+ success = PactBroker::Client::PublishPacts.new(pact_broker_base_url, FileList[pattern], consumer_version).call
36
36
  raise "One or more pacts failed to be published" unless success
37
37
  end
38
38
  end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -5,9 +5,9 @@ module PactBroker
5
5
  class Versions < BaseClient
6
6
 
7
7
 
8
- def last options
8
+ def latest options
9
9
  query = options[:tag] ? {tag: options[:tag]} : {}
10
- response = self.class.get("#{version_base_url(options)}/last", query: query, headers: default_get_headers)
10
+ response = self.class.get("#{version_base_url(options)}/latest", query: query, headers: default_get_headers)
11
11
 
12
12
  handle_response(response) do
13
13
  string_keys_to_symbols(response.to_hash)
@@ -28,5 +28,5 @@ Gem::Specification.new do |gem|
28
28
  gem.add_development_dependency 'pry'
29
29
  gem.add_development_dependency 'fakefs', '~> 0.4'
30
30
  gem.add_development_dependency 'rspec-fire'
31
- gem.add_development_dependency 'debugger'
31
+ #gem.add_development_dependency 'debugger'
32
32
  end
@@ -15,7 +15,7 @@ module PactBroker::Client
15
15
 
16
16
  before do
17
17
  PactBroker::Client::PublishPacts.stub(:new).and_return(publish_pacts)
18
- FileList.should_receive(:[]).with(pattern).and_return(pact_file_list)
18
+ FileList.stub(:[]).with(pattern).and_return(pact_file_list)
19
19
  end
20
20
 
21
21
  let(:pattern) { "spec/pacts/*.json" }
@@ -66,6 +66,19 @@ module PactBroker::Client
66
66
  end
67
67
  end
68
68
 
69
+ describe "timing of block execution" do
70
+
71
+ before :all do
72
+ PactBroker::Client::PublicationTask.new(:exception) do | task |
73
+ raise 'A contrived exception'
74
+ end
75
+ end
76
+
77
+ it "does not execute the block passed to the publication task until the task is called" do
78
+ expect{ Rake::Task['pact:publish:exception'].execute }.to raise_error 'A contrived exception'
79
+ end
80
+ end
81
+
69
82
 
70
83
  end
71
84
 
@@ -23,14 +23,14 @@
23
23
  "body": {
24
24
  "_links": {
25
25
  "self": {
26
- "href": "http://localhost:1234/pacts/latest"
26
+ "href": "http://example.org/pacts/latest"
27
27
  }
28
28
  },
29
29
  "pacts": [
30
30
  {
31
31
  "_links": {
32
32
  "self": {
33
- "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/pacts/Pricing%20Service"
33
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
34
34
  }
35
35
  },
36
36
  "_embedded": {
@@ -38,7 +38,7 @@
38
38
  "name": "Condor",
39
39
  "_links": {
40
40
  "self": {
41
- "href": "http://localhost:1234/pacticipants/Condor"
41
+ "href": "http://example.org/pacticipants/Condor"
42
42
  }
43
43
  },
44
44
  "_embedded": {
@@ -50,7 +50,7 @@
50
50
  "provider": {
51
51
  "_links": {
52
52
  "self": {
53
- "href": "http://localhost:1234/pacticipants/Pricing%20Service"
53
+ "href": "http://example.org/pacticipants/Pricing%20Service"
54
54
  }
55
55
  },
56
56
  "name": "Pricing Service"
@@ -78,12 +78,12 @@
78
78
  "body": {
79
79
  "_links": {
80
80
  "self": {
81
- "href": "http://localhost:1234/pacticipants"
81
+ "href": "http://example.org/pacticipants"
82
82
  },
83
83
  "pacticipants": [
84
84
  {
85
- "href": "http://localhost:1234/pacticipants/Condor",
86
- "name": "Condor"
85
+ "href": "http://example.org/pacticipants/Condor",
86
+ "title": "Condor"
87
87
  }
88
88
  ]
89
89
  },
@@ -91,15 +91,15 @@
91
91
  {
92
92
  "_links": {
93
93
  "self": {
94
- "href": "http://localhost:1234/pacticipants/Condor"
94
+ "href": "http://example.org/pacticipants/Condor"
95
95
  }
96
96
  },
97
97
  "name": "Condor",
98
98
  "_embedded": {
99
- "last_version": {
99
+ "latest_version": {
100
100
  "_links": {
101
101
  "self": {
102
- "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0"
102
+ "href": "http://example.org/pacticipants/Condor/versions/1.3.0"
103
103
  }
104
104
  },
105
105
  "number": "1.3.0"
@@ -127,22 +127,22 @@
127
127
  "body": {
128
128
  "_links": {
129
129
  "self": {
130
- "href": "http://localhost:1234/pacticipants/Pricing%20Service"
130
+ "href": "http://example.org/pacticipants/Pricing%20Service"
131
131
  },
132
132
  "versions": {
133
- "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions"
133
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions"
134
134
  },
135
- "last_version": {
136
- "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions/last"
135
+ "latest_version": {
136
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/latest"
137
137
  }
138
138
  },
139
139
  "name": "Pricing Service",
140
140
  "repository_url": "git@git.realestate.com.au:business-systems/pricing-service",
141
141
  "_embedded": {
142
- "last_version": {
142
+ "latest_version": {
143
143
  "_links": {
144
144
  "self": {
145
- "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions/1.3.0"
145
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/1.3.0"
146
146
  }
147
147
  },
148
148
  "number": "1.3.0"
@@ -465,7 +465,7 @@
465
465
  "provider_state": "a version with production details exists for the Pricing Service",
466
466
  "request": {
467
467
  "method": "get",
468
- "path": "/pacticipants/Pricing%20Service/versions/last",
468
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
469
469
  "headers": {
470
470
  "Accept": "application/json"
471
471
  },
@@ -490,7 +490,7 @@
490
490
  "provider_state": "no version exists for the Pricing Service",
491
491
  "request": {
492
492
  "method": "get",
493
- "path": "/pacticipants/Pricing%20Service/versions/last",
493
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
494
494
  "headers": {
495
495
  "Accept": "application/json"
496
496
  }
@@ -39,7 +39,7 @@ module PactBroker::Client
39
39
  )
40
40
  end
41
41
  it "returns the response body" do
42
- expect(pact_broker_client.pacts.latest).to eq(expected_pacts)
42
+ expect(pact_broker_client.pacts.list_latest).to eq(expected_pacts)
43
43
  end
44
44
  end
45
45
  end
@@ -48,7 +48,7 @@ module PactBroker::Client
48
48
  )
49
49
  end
50
50
  it "returns true" do
51
- pact_broker_client.pacticipants.versions.pacts.publish options
51
+ expect(pact_broker_client.pacticipants.versions.pacts.publish(options)).to be_true
52
52
  end
53
53
  end
54
54
 
@@ -67,7 +67,7 @@ module PactBroker::Client
67
67
  )
68
68
  end
69
69
  it "returns true" do
70
- pact_broker_client.pacticipants.versions.pacts.publish options
70
+ expect(pact_broker_client.pacticipants.versions.pacts.publish(options)).to be_true
71
71
  end
72
72
  end
73
73
 
@@ -86,7 +86,7 @@ module PactBroker::Client
86
86
  )
87
87
  end
88
88
  it "returns true" do
89
- pact_broker_client.pacticipants.versions.pacts.publish options
89
+ expect(pact_broker_client.pacticipants.versions.pacts.publish(options)).to be_true
90
90
  end
91
91
  end
92
92
 
@@ -244,7 +244,7 @@ module PactBroker::Client
244
244
  end
245
245
 
246
246
  it "returns the pact json" do
247
- response = pact_broker_client.pacticipants.versions.pacts.last consumer: 'Condor', provider: 'Pricing Service'
247
+ response = pact_broker_client.pacticipants.versions.pacts.latest consumer: 'Condor', provider: 'Pricing Service'
248
248
  expect(response).to eq(pact_json)
249
249
  end
250
250
 
@@ -265,7 +265,7 @@ module PactBroker::Client
265
265
  })
266
266
  end
267
267
  it "returns nil" do
268
- response = pact_broker_client.pacticipants.versions.pacts.last consumer: 'Condor', provider: 'Pricing Service'
268
+ response = pact_broker_client.pacticipants.versions.pacts.latest consumer: 'Condor', provider: 'Pricing Service'
269
269
  expect(response).to eq(nil)
270
270
  end
271
271
  end
@@ -290,7 +290,7 @@ module PactBroker::Client
290
290
  end
291
291
 
292
292
  it "returns the pact json" do
293
- response = pact_broker_client.pacticipants.versions.pacts.last consumer: 'Condor', provider: 'Pricing Service', tag: 'prod'
293
+ response = pact_broker_client.pacticipants.versions.pacts.latest consumer: 'Condor', provider: 'Pricing Service', tag: 'prod'
294
294
  expect(response).to eq(pact_json)
295
295
  end
296
296
  end
@@ -309,7 +309,7 @@ module PactBroker::Client
309
309
  upon_receiving("a request for the latest version tagged with 'prod'").
310
310
  with(
311
311
  method: :get,
312
- path: '/pacticipants/Pricing%20Service/versions/last',
312
+ path: '/pacticipants/Pricing%20Service/versions/latest',
313
313
  query: 'tag=prod',
314
314
  headers: get_request_headers).
315
315
  will_respond_with( status: 200,
@@ -317,7 +317,7 @@ module PactBroker::Client
317
317
  body: body )
318
318
  end
319
319
  it 'returns the version details' do
320
- expect( pact_broker_client.pacticipants.versions.last pacticipant: 'Pricing Service', tag: 'prod' ).to eq body
320
+ expect( pact_broker_client.pacticipants.versions.latest pacticipant: 'Pricing Service', tag: 'prod' ).to eq body
321
321
  end
322
322
  end
323
323
  end
@@ -326,11 +326,11 @@ module PactBroker::Client
326
326
  pact_broker.
327
327
  given("no version exists for the Pricing Service").
328
328
  upon_receiving("a request for the latest version").
329
- with(method: :get, path: '/pacticipants/Pricing%20Service/versions/last', headers: get_request_headers).
329
+ with(method: :get, path: '/pacticipants/Pricing%20Service/versions/latest', headers: get_request_headers).
330
330
  will_respond_with( status: 404, headers: pact_broker_response_headers )
331
331
  end
332
332
  it 'returns nil' do
333
- expect( pact_broker_client.pacticipants.versions.last pacticipant: 'Pricing Service' ).to eq nil
333
+ expect( pact_broker_client.pacticipants.versions.latest pacticipant: 'Pricing Service' ).to eq nil
334
334
  end
335
335
  end
336
336
  end
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "_links": {
3
- "self": { "href": "http://localhost:1234/pacticipants/Pricing%20Service" },
4
- "versions": { "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions" },
5
- "last_version": { "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions/last" }
3
+ "self": { "href": "http://example.org/pacticipants/Pricing%20Service" },
4
+ "versions": { "href": "http://example.org/pacticipants/Pricing%20Service/versions" },
5
+ "latest_version": { "href": "http://example.org/pacticipants/Pricing%20Service/versions/latest" }
6
6
  },
7
7
  "name" : "Pricing Service",
8
8
  "repository_url": "git@git.realestate.com.au:business-systems/pricing-service",
9
9
  "_embedded" : {
10
- "last_version" : {
10
+ "latest_version" : {
11
11
  "_links" : {
12
12
  "self": {
13
- "href": "http://localhost:1234/pacticipants/Pricing%20Service/versions/1.3.0"
13
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/1.3.0"
14
14
  }
15
15
  },
16
16
  "number" : "1.3.0"
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "_links": {
3
- "self": { "href": "http://localhost:1234/pacticipants" },
3
+ "self": { "href": "http://example.org/pacticipants" },
4
4
  "pacticipants": [
5
- { "href": "http://localhost:1234/pacticipants/Condor", "name": "Condor" }
5
+ { "href": "http://example.org/pacticipants/Condor", "title": "Condor" }
6
6
  ]
7
7
  },
8
8
  "pacticipants" : [{
9
9
  "_links": {
10
10
  "self" : {
11
- "href" : "http://localhost:1234/pacticipants/Condor"
11
+ "href" : "http://example.org/pacticipants/Condor"
12
12
  }
13
13
  },
14
14
  "name" : "Condor",
15
15
  "_embedded" : {
16
- "last_version" : {
16
+ "latest_version" : {
17
17
  "_links" : {
18
18
  "self": {
19
- "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0"
19
+ "href": "http://example.org/pacticipants/Condor/versions/1.3.0"
20
20
  }
21
21
  },
22
22
  "number" : "1.3.0"
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "_links": {
3
3
  "self": {
4
- "href": "http://localhost:1234/pacts/latest"
4
+ "href": "http://example.org/pacts/latest"
5
5
  }
6
6
  },
7
7
  "pacts": [
8
8
  {
9
9
  "_links": {
10
10
  "self": {
11
- "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/pacts/Pricing%20Service"
11
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
12
12
  }
13
13
  },
14
14
  "_embedded": {
@@ -16,7 +16,7 @@
16
16
  "name": "Condor",
17
17
  "_links": {
18
18
  "self": {
19
- "href": "http://localhost:1234/pacticipants/Condor"
19
+ "href": "http://example.org/pacticipants/Condor"
20
20
  }
21
21
  },
22
22
  "_embedded": {
@@ -28,7 +28,7 @@
28
28
  "provider": {
29
29
  "_links": {
30
30
  "self": {
31
- "href": "http://localhost:1234/pacticipants/Pricing%20Service"
31
+ "href": "http://example.org/pacticipants/Pricing%20Service"
32
32
  }
33
33
  },
34
34
  "name": "Pricing Service"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-12 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pact
@@ -123,22 +123,6 @@ dependencies:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: debugger
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
126
  description: Publishes pacts to, and retrieves pacts from, the pact broker server.
143
127
  email:
144
128
  - bskurrie@dius.com.au
@@ -193,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
177
  version: '0'
194
178
  segments:
195
179
  - 0
196
- hash: 931028457925136727
180
+ hash: -1305860573935195556
197
181
  required_rubygems_version: !ruby/object:Gem::Requirement
198
182
  none: false
199
183
  requirements:
@@ -202,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
186
  version: '0'
203
187
  segments:
204
188
  - 0
205
- hash: 931028457925136727
189
+ hash: -1305860573935195556
206
190
  requirements: []
207
191
  rubyforge_project:
208
192
  rubygems_version: 1.8.23