pact 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,11 @@
1
1
  Do this to generate your change history
2
2
 
3
- git log --pretty=format:' * %h - %s (%an, %ad)'
3
+ git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
4
+
5
+ ### 1.7.0 (20 March 2015)
6
+
7
+ * 61ce2da - Upgraded pact-support and pact-mock_service gems (Beth Skurrie, Fri Mar 20 15:05:14 2015 +1100)
8
+ * 40666b6 - In pact verification DSL pass extra options for pact uri for http basic authentication. In pact:verify:at[url] task pass http basic authentication info via environment variables (lifei zhou, Thu Feb 26 23:35:32 2015 +1100)
4
9
 
5
10
  ### 1.6.0 (17 February 2015)
6
11
 
@@ -7,6 +7,8 @@ module Pact
7
7
  desc 'verify', "Verify a pact"
8
8
  method_option :pact_helper, aliases: "-h", desc: "Pact helper file", :required => true
9
9
  method_option :pact_uri, aliases: "-p", desc: "Pact URI"
10
+ method_option :pact_broker_username, aliases: "-u", desc: "Pact broker user name"
11
+ method_option :pact_broker_password, aliases: "-w", desc: "Pact broker password"
10
12
  method_option :backtrace, aliases: "-b", desc: "Show full backtrace", :default => false, :type => :boolean
11
13
  method_option :description, aliases: "-d", desc: "Interaction description filter"
12
14
  method_option :provider_state, aliases: "-s", desc: "Provider state filter"
@@ -53,7 +53,11 @@ module Pact
53
53
  end
54
54
 
55
55
  def run_with_pact_uri
56
- Pact::Provider::PactSpecRunner.new([options[:pact_uri]], pact_spec_options).run
56
+ pact_repository_uri_options = {}
57
+ pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username]
58
+ pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password]
59
+ pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options)
60
+ Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run
57
61
  end
58
62
 
59
63
  def run_with_configured_pacts
@@ -1,4 +1,5 @@
1
1
  require 'pact/provider/pact_verification'
2
+ require 'pact/provider/pact_uri'
2
3
  require 'pact/shared/dsl'
3
4
  require 'pact/provider/world'
4
5
 
@@ -20,8 +21,8 @@ module Pact
20
21
  end
21
22
 
22
23
  dsl do
23
- def pact_uri pact_uri
24
- self.pact_uri = pact_uri
24
+ def pact_uri pact_uri, options = {}
25
+ self.pact_uri = ::Pact::Provider::PactURI.new(pact_uri, options) if pact_uri
25
26
  end
26
27
  end
27
28
 
@@ -11,7 +11,7 @@ module PactBroker
11
11
  end
12
12
 
13
13
  def pact_json
14
- @pact_json ||= Pact::PactFile.read(uri, {})
14
+ @pact_json ||= Pact::PactFile.read(uri.uri, uri.options)
15
15
  end
16
16
 
17
17
  end
@@ -0,0 +1,18 @@
1
+ module Pact
2
+ module Provider
3
+ class PactURI
4
+ attr_reader :uri, :options
5
+
6
+ def initialize (uri, options={})
7
+ @uri = uri
8
+ @options = options
9
+ end
10
+
11
+ def == other
12
+ other.is_a?(PactURI) &&
13
+ uri == other.uri &&
14
+ options == other.options
15
+ end
16
+ end
17
+ end
18
+ end
@@ -20,7 +20,7 @@ module Pact
20
20
 
21
21
  def honour_pactfile pact_uri, pact_json, options
22
22
  #TODO change puts to use output stream
23
- puts "Reading pact at #{pact_uri}"
23
+ puts "Reading pact at #{pact_uri.uri}"
24
24
  puts "Filtering interactions by: #{options[:criteria]}" if options[:criteria] && options[:criteria].any?
25
25
  consumer_contract = Pact::ConsumerContract.from_json(pact_json)
26
26
  ::RSpec.describe "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}", :pactfile_uri => pact_uri do
@@ -25,6 +25,9 @@ module Pact
25
25
  command_parts << "-S pact verify"
26
26
  command_parts << "--pact-helper" << (pact_helper.end_with?(".rb") ? pact_helper : pact_helper + ".rb")
27
27
  (command_parts << "--pact-uri" << pact_uri) if pact_uri
28
+ command_parts << "--pact-broker-username" << ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
29
+ command_parts << "--pact-broker-password" << ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
30
+ command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
28
31
  command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
29
32
  command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
30
33
  command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE']
@@ -1,3 +1,3 @@
1
1
  module Pact
2
- VERSION = "1.6.0"
2
+ VERSION = "1.7.0"
3
3
  end
@@ -28,8 +28,8 @@ Gem::Specification.new do |gem|
28
28
  gem.add_runtime_dependency 'webrick'
29
29
  gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
30
30
 
31
- gem.add_runtime_dependency 'pact-support', '~> 0.3.0'
32
- gem.add_runtime_dependency 'pact-mock_service', '~> 0.4.0'
31
+ gem.add_runtime_dependency 'pact-support', '~> 0.4.0'
32
+ gem.add_runtime_dependency 'pact-mock_service', '~> 0.5.0'
33
33
 
34
34
  gem.add_development_dependency 'rake', '~> 10.0.3'
35
35
  gem.add_development_dependency 'webmock', '~> 1.18.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-02-17 00:00:00.000000000 Z
16
+ date: 2015-03-20 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: randexp
@@ -166,7 +166,7 @@ dependencies:
166
166
  requirements:
167
167
  - - ~>
168
168
  - !ruby/object:Gem::Version
169
- version: 0.3.0
169
+ version: 0.4.0
170
170
  type: :runtime
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ dependencies:
174
174
  requirements:
175
175
  - - ~>
176
176
  - !ruby/object:Gem::Version
177
- version: 0.3.0
177
+ version: 0.4.0
178
178
  - !ruby/object:Gem::Dependency
179
179
  name: pact-mock_service
180
180
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +182,7 @@ dependencies:
182
182
  requirements:
183
183
  - - ~>
184
184
  - !ruby/object:Gem::Version
185
- version: 0.4.0
185
+ version: 0.5.0
186
186
  type: :runtime
187
187
  prerelease: false
188
188
  version_requirements: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ dependencies:
190
190
  requirements:
191
191
  - - ~>
192
192
  - !ruby/object:Gem::Version
193
- version: 0.4.0
193
+ version: 0.5.0
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: rake
196
196
  requirement: !ruby/object:Gem::Requirement
@@ -383,6 +383,7 @@ files:
383
383
  - lib/pact/provider/pact_helper_locator.rb
384
384
  - lib/pact/provider/pact_source.rb
385
385
  - lib/pact/provider/pact_spec_runner.rb
386
+ - lib/pact/provider/pact_uri.rb
386
387
  - lib/pact/provider/pact_verification.rb
387
388
  - lib/pact/provider/print_missing_provider_states.rb
388
389
  - lib/pact/provider/request.rb
@@ -422,7 +423,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
422
423
  version: '0'
423
424
  segments:
424
425
  - 0
425
- hash: 1564031949540050912
426
+ hash: 2424764158045904869
426
427
  required_rubygems_version: !ruby/object:Gem::Requirement
427
428
  none: false
428
429
  requirements:
@@ -431,7 +432,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
431
432
  version: '0'
432
433
  segments:
433
434
  - 0
434
- hash: 1564031949540050912
435
+ hash: 2424764158045904869
435
436
  requirements: []
436
437
  rubyforge_project:
437
438
  rubygems_version: 1.8.23