pact_broker-client 1.3.0 → 1.4.0

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: 9a8dab4f53fb2a35fd1d121dfc10c7d6ba07c1ac
4
- data.tar.gz: 7a32febac80a24893016af889af96c9a33fcad22
3
+ metadata.gz: e3553f62a8b0f25fd43c38284289fb14cad42f68
4
+ data.tar.gz: 454ee12554927fb5e771b7d2afe6b59bf37bcfcb
5
5
  SHA512:
6
- metadata.gz: 20b659f85416883f3649448803ffe5b4f9a93073462df04c635780e376f8e16d2bcce4658bd127a98bbbee07ad057c2009d1b76b0625cac6d03ce92befa12417
7
- data.tar.gz: 8e0ab94d47be12c18fa995717911a9e03b7c9d562ff5a73c4f076d543f6993516db29dd209103c98e5a4bd4c6222b77727f9a9ffb3f3bbbe3d1b01bec73f33ad
6
+ metadata.gz: 48f3d3a99d610f7702b47771134035a6a79134f8cb24b3321d019e62edf683e353b45af9b5eb99d31af1efd54758ee54ec9f7beaf82d8b591c7f2e5445fcf01d
7
+ data.tar.gz: 9586956310869d128a46c3fbd7664aa09ffa9fe49220a5ef7cf80362454951ba6d318069f92ea3ec6298284aeadeb51a50d6ff715066851a832301b29b90b5a3
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --format documentation
3
+ --require spec_helper
data/.travis.yml CHANGED
@@ -4,7 +4,6 @@ rvm:
4
4
  - 2.1.8
5
5
  - 2.2.4
6
6
  - 2.3.1
7
- - jruby-9.0.5.0
8
7
  gemfile:
9
8
  - gemfiles/default.gemfile
10
9
  - gemfiles/ruby_under_22.gemfile
data/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
- Do this to generate your change history
1
+ <a name="v1.4.0"></a>
2
+ ### v1.4.0 (2017-09-07)
2
3
 
3
- $ git log --pretty=format:' * %h - %s (%an, %ad)' vX.Y.Z..HEAD
4
+ #### Features
4
5
 
5
- #### 1.3.0 (2017-07-03)
6
+ * **tagging**
7
+ * url escape tag names ([8335978](/../../commit/8335978))
8
+ * allow multiple tags to be specified for a version ([5f862fe](/../../commit/5f862fe))
9
+
10
+ #### v1.3.0 (2017-07-03)
6
11
  * 138a042 - feat(tag): Added tag to PublicationTask (Beth Skurrie, Mon Jul 3 11:45:24 2017 +1000)
7
12
 
8
13
  #### 1.2.0 (2016-11-23)
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source 'https://rubygems.org'
2
- #source 'http://rea-rubygems'
3
2
 
4
3
  gemspec
4
+
5
+ # Not sure why jruby on Travis fails saying rake is not part of the bundle,
6
+ # even thought it's in the development dependencies. Trying it here.
7
+ gem 'rake', '~> 10.0.3'
data/README.md CHANGED
@@ -6,7 +6,7 @@ A client for the Pact Broker. Publishes pacts to, and retrieves pacts from, the
6
6
 
7
7
  ## Usage
8
8
 
9
- You will need an instance of a [Pact Broker](https://github.com/bethesque/pact_broker). It's URL will be used below in the configuration for the Consumer and the Provider. eg. http://pact-broker.my.org
9
+ You will need an instance of a [Pact Broker](https://github.com/pact-foundation/pact_broker). It's URL will be used below in the configuration for the Consumer and the Provider. eg. http://pact-broker.my.org
10
10
 
11
11
  ### Consumer
12
12
 
@@ -25,7 +25,7 @@ PactBroker::Client::PublicationTask.new do | task |
25
25
  require 'my_consumer/version'
26
26
  task.consumer_version = MyConsumer::VERSION
27
27
  task.pact_broker_base_url = "http://pact-broker.my.org"
28
- task.tag = "dev" # optional
28
+ task.tags = ["dev"] # optional
29
29
  task.pact_broker_basic_auth = { username: 'basic_auth_user', password: 'basic_auth_pass'} #optional
30
30
  task.write_method = :merge # optional, this will merge the published pact into an existing pact rather than overwriting it if one exists. Not recommended, as it makes a mulch of the workflow on the broker.
31
31
  end
data/RELEASING.md CHANGED
@@ -4,12 +4,12 @@
4
4
  2. `bundle exec appraisal update`
5
5
  3. Update the `CHANGELOG.md` using:
6
6
 
7
- $ git log --pretty=format:' * %h - %s (%an, %ad)'
7
+ $ bundle exec rake generate_changelog
8
8
 
9
9
  4. Add files to git
10
10
 
11
11
  $ git add CHANGELOG.md lib/pact_broker/client/version.rb
12
- $ git commit -m "Releasing version X.Y.Z"
12
+ $ git commit -m "Releasing version $(ruby -r ./lib/pact_broker/client/version.rb -e "puts PactBroker::Client::VERSION")"
13
13
 
14
14
  5. Release:
15
15
 
data/Rakefile CHANGED
@@ -1,8 +1,14 @@
1
1
  require "bundler/gem_tasks"
2
2
  require 'rspec/core/rake_task'
3
+ require 'conventional_changelog'
3
4
 
4
5
  Dir.glob('lib/tasks/**/*.rake').each { |task| load "#{Dir.pwd}/#{task}" }
5
6
  Dir.glob('tasks/**/*.rake').each { |task| load "#{Dir.pwd}/#{task}" }
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
9
  task :default => [:spec]
10
+
11
+ task :generate_changelog do
12
+ require 'pact_broker/client/version'
13
+ ConventionalChangelog::Generator.new.generate! version: "v#{PactBroker::Client::VERSION}"
14
+ end
@@ -2,4 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "rake", "~> 10.0.3"
6
+
5
7
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- pact_broker-client (1.2.0)
4
+ pact_broker-client (1.4.0)
5
5
  httparty
6
6
  json
7
7
  pact
@@ -10,41 +10,46 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
+ addressable (2.5.2)
14
+ public_suffix (>= 2.0.2, < 4.0)
13
15
  appraisal (2.2.0)
14
16
  bundler
15
17
  rake
16
18
  thor (>= 0.14.0)
17
- awesome_print (1.7.0)
18
- coderay (1.1.1)
19
+ awesome_print (1.8.0)
20
+ coderay (1.1.2)
21
+ crack (0.4.3)
22
+ safe_yaml (~> 1.0.0)
19
23
  diff-lcs (1.3)
20
- fakefs (0.11.0)
24
+ fakefs (0.11.1)
21
25
  find_a_port (1.0.1)
22
- httparty (0.14.0)
26
+ hashdiff (0.3.6)
27
+ httparty (0.15.6)
23
28
  multi_xml (>= 0.5.2)
24
29
  json (2.1.0)
25
30
  method_source (0.8.2)
26
31
  multi_xml (0.6.0)
27
- pact (1.11.1)
32
+ pact (1.15.0)
28
33
  json (> 1.8.5)
29
- pact-mock_service (~> 1.2)
30
- pact-support (~> 0.6)
34
+ pact-mock_service (~> 2.0)
35
+ pact-support (~> 1.1)
31
36
  rack-test (~> 0.6.2)
32
37
  randexp (~> 0.1.7)
33
38
  rspec (>= 2.14)
34
39
  term-ansicolor (~> 1.0)
35
40
  thor
36
41
  webrick
37
- pact-mock_service (1.2.0)
42
+ pact-mock_service (2.1.0)
38
43
  find_a_port (~> 1.0.1)
39
44
  json
40
- pact-support (~> 0.6)
45
+ pact-support (~> 1.0)
41
46
  rack
42
47
  rack-test (~> 0.6.2)
43
48
  rspec (>= 2.14)
44
49
  term-ansicolor (~> 1.0)
45
50
  thor
46
51
  webrick
47
- pact-support (0.6.1)
52
+ pact-support (1.1.6)
48
53
  awesome_print (~> 1.1)
49
54
  find_a_port (~> 1.0.1)
50
55
  json
@@ -57,7 +62,8 @@ GEM
57
62
  coderay (~> 1.1.0)
58
63
  method_source (~> 0.8.1)
59
64
  slop (~> 3.4)
60
- rack (2.0.2)
65
+ public_suffix (3.0.0)
66
+ rack (2.0.3)
61
67
  rack-test (0.6.3)
62
68
  rack (>= 1.0)
63
69
  rake (10.0.4)
@@ -77,11 +83,16 @@ GEM
77
83
  diff-lcs (>= 1.2.0, < 2.0)
78
84
  rspec-support (~> 3.6.0)
79
85
  rspec-support (3.6.0)
86
+ safe_yaml (1.0.4)
80
87
  slop (3.6.0)
81
88
  term-ansicolor (1.6.0)
82
89
  tins (~> 1.0)
83
- thor (0.19.4)
84
- tins (1.13.2)
90
+ thor (0.20.0)
91
+ tins (1.15.0)
92
+ webmock (3.0.1)
93
+ addressable (>= 2.3.6)
94
+ crack (>= 0.3.2)
95
+ hashdiff
85
96
  webrick (1.3.1)
86
97
 
87
98
  PLATFORMS
@@ -94,6 +105,7 @@ DEPENDENCIES
94
105
  pry
95
106
  rake (~> 10.0.3)
96
107
  rspec-fire
108
+ webmock (~> 3.0)
97
109
 
98
110
  BUNDLED WITH
99
- 1.14.6
111
+ 1.15.4
@@ -2,6 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "rake", "~> 10.0.3"
5
6
  gem "rack", "< 2.0"
6
7
 
7
8
  gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- pact_broker-client (1.2.0)
4
+ pact_broker-client (1.4.0)
5
5
  httparty
6
6
  json
7
7
  pact
@@ -10,41 +10,46 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
+ addressable (2.5.2)
14
+ public_suffix (>= 2.0.2, < 4.0)
13
15
  appraisal (2.2.0)
14
16
  bundler
15
17
  rake
16
18
  thor (>= 0.14.0)
17
- awesome_print (1.7.0)
18
- coderay (1.1.1)
19
+ awesome_print (1.8.0)
20
+ coderay (1.1.2)
21
+ crack (0.4.3)
22
+ safe_yaml (~> 1.0.0)
19
23
  diff-lcs (1.3)
20
- fakefs (0.11.0)
24
+ fakefs (0.11.1)
21
25
  find_a_port (1.0.1)
22
- httparty (0.14.0)
26
+ hashdiff (0.3.6)
27
+ httparty (0.15.6)
23
28
  multi_xml (>= 0.5.2)
24
29
  json (2.1.0)
25
30
  method_source (0.8.2)
26
31
  multi_xml (0.6.0)
27
- pact (1.11.1)
32
+ pact (1.15.0)
28
33
  json (> 1.8.5)
29
- pact-mock_service (~> 1.2)
30
- pact-support (~> 0.6)
34
+ pact-mock_service (~> 2.0)
35
+ pact-support (~> 1.1)
31
36
  rack-test (~> 0.6.2)
32
37
  randexp (~> 0.1.7)
33
38
  rspec (>= 2.14)
34
39
  term-ansicolor (~> 1.0)
35
40
  thor
36
41
  webrick
37
- pact-mock_service (1.2.0)
42
+ pact-mock_service (2.1.0)
38
43
  find_a_port (~> 1.0.1)
39
44
  json
40
- pact-support (~> 0.6)
45
+ pact-support (~> 1.0)
41
46
  rack
42
47
  rack-test (~> 0.6.2)
43
48
  rspec (>= 2.14)
44
49
  term-ansicolor (~> 1.0)
45
50
  thor
46
51
  webrick
47
- pact-support (0.6.1)
52
+ pact-support (1.1.6)
48
53
  awesome_print (~> 1.1)
49
54
  find_a_port (~> 1.0.1)
50
55
  json
@@ -57,7 +62,8 @@ GEM
57
62
  coderay (~> 1.1.0)
58
63
  method_source (~> 0.8.1)
59
64
  slop (~> 3.4)
60
- rack (1.6.6)
65
+ public_suffix (3.0.0)
66
+ rack (1.6.8)
61
67
  rack-test (0.6.3)
62
68
  rack (>= 1.0)
63
69
  rake (10.0.4)
@@ -77,11 +83,16 @@ GEM
77
83
  diff-lcs (>= 1.2.0, < 2.0)
78
84
  rspec-support (~> 3.6.0)
79
85
  rspec-support (3.6.0)
86
+ safe_yaml (1.0.4)
80
87
  slop (3.6.0)
81
88
  term-ansicolor (1.6.0)
82
89
  tins (~> 1.0)
83
- thor (0.19.4)
84
- tins (1.13.2)
90
+ thor (0.20.0)
91
+ tins (1.15.0)
92
+ webmock (3.0.1)
93
+ addressable (>= 2.3.6)
94
+ crack (>= 0.3.2)
95
+ hashdiff
85
96
  webrick (1.3.1)
86
97
 
87
98
  PLATFORMS
@@ -95,6 +106,7 @@ DEPENDENCIES
95
106
  rack (< 2.0)
96
107
  rake (~> 10.0.3)
97
108
  rspec-fire
109
+ webmock (~> 3.0)
98
110
 
99
111
  BUNDLED WITH
100
- 1.14.6
112
+ 1.15.4
@@ -6,31 +6,34 @@ module PactBroker
6
6
  module Client
7
7
  class PublishPacts
8
8
 
9
- def initialize pact_broker_base_url, pact_files, consumer_version, tag, pact_broker_client_options={}
9
+ def initialize pact_broker_base_url, pact_files, consumer_version, tags, pact_broker_client_options={}
10
10
  @pact_broker_base_url = pact_broker_base_url
11
11
  @pact_files = pact_files
12
12
  @consumer_version = consumer_version
13
- @tag = tag
13
+ @tags = tags
14
14
  @pact_broker_client_options = pact_broker_client_options
15
15
  end
16
16
 
17
17
  def call
18
18
  validate
19
19
  $stdout.puts("")
20
- result = pact_files.collect{ | pact_file | publish_pact pact_file }.all?
21
- result = result && tag_consumer_version
20
+ result = apply_tags && publish_pacts
22
21
  $stdout.puts("")
23
22
  result
24
23
  end
25
24
 
26
25
  private
27
26
 
28
- attr_reader :pact_broker_base_url, :pact_files, :consumer_version, :tag, :pact_broker_client_options
27
+ attr_reader :pact_broker_base_url, :pact_files, :consumer_version, :tags, :pact_broker_client_options
29
28
 
30
29
  def pact_broker_client
31
30
  @pact_broker_client ||= PactBroker::Client::PactBrokerClient.new(base_url: pact_broker_base_url, client_options: pact_broker_client_options)
32
31
  end
33
32
 
33
+ def publish_pacts
34
+ pact_files.collect{ | pact_file | publish_pact pact_file }.all?
35
+ end
36
+
34
37
  def publish_pact pact_file
35
38
  begin
36
39
  $stdout.puts ">> Publishing #{pact_file} to pact broker at #{pact_broker_base_url}"
@@ -41,12 +44,19 @@ module PactBroker
41
44
  end
42
45
  end
43
46
 
44
- def tag_consumer_version
45
- return true unless tag
47
+ def apply_tags
48
+ return true if tags.nil? || tags.empty?
49
+ tags.all? do | tag |
50
+ tag_consumer_version tag
51
+ end
52
+ end
53
+
54
+ def tag_consumer_version tag
46
55
  versions = pact_broker_client.pacticipants.versions
47
56
  Retry.until_true do
48
57
  $stdout.puts "Tagging version #{consumer_version} of #{consumer_name} as #{tag.inspect}"
49
58
  versions.tag(pacticipant: consumer_name, version: consumer_version, tag: tag)
59
+ true
50
60
  end
51
61
  rescue => e
52
62
  $stderr.puts "Failed to tag version #{consumer_version} of #{consumer_name} due to error: #{e.to_s}\n#{e.backtrace.join("\n")}"
@@ -17,6 +17,7 @@ module PactBroker
17
17
  class PublicationTask < ::Rake::TaskLib
18
18
 
19
19
  attr_accessor :pattern, :pact_broker_base_url, :consumer_version, :tag, :write_method, :pact_broker_basic_auth
20
+ alias_method :tags, :tag
20
21
 
21
22
  def initialize name = nil, &block
22
23
  @name = name
@@ -35,7 +36,7 @@ module PactBroker
35
36
  require 'pact_broker/client/publish_pacts'
36
37
  basic_auth_client_options = pact_broker_basic_auth ? {basic_auth: pact_broker_basic_auth} : {}
37
38
  pact_broker_client_options = basic_auth_client_options.merge(write_method ? {write: write_method} : {})
38
- success = PactBroker::Client::PublishPacts.new(pact_broker_base_url, FileList[pattern], consumer_version, tag, pact_broker_client_options).call
39
+ success = PactBroker::Client::PublishPacts.new(pact_broker_base_url, FileList[pattern], consumer_version, [*tags], pact_broker_client_options).call
39
40
  raise "One or more pacts failed to be published" unless success
40
41
  end
41
42
  end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.3.0'
3
+ VERSION = '1.4.0'
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'base_client'
2
+ require 'pact_broker/client/pacts'
2
3
 
3
4
  module PactBroker
4
5
  module Client
@@ -38,7 +39,7 @@ module PactBroker
38
39
  private
39
40
 
40
41
  def tag_url options
41
- "#{version_base_url(options)}/tags/#{options.fetch(:tag)}"
42
+ "#{version_base_url(options)}/tags/#{encode_param(options.fetch(:tag))}"
42
43
  end
43
44
 
44
45
  def versions_base_url options
@@ -26,9 +26,10 @@ Gem::Specification.new do |gem|
26
26
  gem.add_runtime_dependency 'json'
27
27
  gem.add_runtime_dependency 'term-ansicolor'
28
28
 
29
- gem.add_development_dependency 'rake', '~> 10.0.3'
30
29
  gem.add_development_dependency 'pry'
31
30
  gem.add_development_dependency 'fakefs', '~> 0.4'
32
31
  gem.add_development_dependency 'rspec-fire'
33
32
  gem.add_development_dependency 'appraisal'
33
+ gem.add_development_dependency 'webmock', '~> 3.0'
34
+ gem.add_development_dependency 'conventional-changelog'
34
35
  end
@@ -22,7 +22,7 @@ module PactBroker
22
22
  let(:pact_broker_client) { double("PactBroker::Client")}
23
23
  let(:pact_files) { ['spec/pacts/consumer-provider.json']}
24
24
  let(:consumer_version) { "1.2.3" }
25
- let(:tag) { nil }
25
+ let(:tags) { nil }
26
26
  let(:pact_hash) { {consumer: {name: 'Consumer'}, provider: {name: 'Provider'}, interactions: [] } }
27
27
  let(:pacts_client) { instance_double("PactBroker::ClientSupport::Pacts")}
28
28
  let(:pact_versions_client) { instance_double("PactBroker::Client::Versions", tag: false) }
@@ -36,7 +36,7 @@ module PactBroker
36
36
  }
37
37
  end
38
38
 
39
- subject { PublishPacts.new(pact_broker_base_url, pact_files, consumer_version, tag, pact_broker_client_options) }
39
+ subject { PublishPacts.new(pact_broker_base_url, pact_files, consumer_version, tags, pact_broker_client_options) }
40
40
 
41
41
  before do
42
42
  FileUtils.mkdir_p "spec/pacts"
@@ -109,10 +109,16 @@ module PactBroker
109
109
  end
110
110
 
111
111
  context "when a tag is provided" do
112
- let(:tag) { "dev" }
112
+ let(:tags) { ["dev"] }
113
113
 
114
114
  it "tags the consumer version" do
115
- expect(pact_versions_client).to receive(:tag).with({pacticipant: "Consumer", version: consumer_version, tag: tag})
115
+ expect(pact_versions_client).to receive(:tag).with({pacticipant: "Consumer", version: consumer_version, tag: "dev"})
116
+ subject.call
117
+ end
118
+
119
+ it "tags the version before publishing the pact so that there aren't timing issues retrieving pacts by tag" do
120
+ expect(pact_versions_client).to receive(:tag).ordered
121
+ expect(pacts_client).to receive(:publish).ordered
116
122
  subject.call
117
123
  end
118
124
 
@@ -14,8 +14,8 @@ module PactBroker::Client
14
14
  let(:pact_file_list) { ['spec/pact/consumer-provider.json'] }
15
15
 
16
16
  before do
17
- PactBroker::Client::PublishPacts.stub(:new).and_return(publish_pacts)
18
- FileList.stub(:[]).with(pattern).and_return(pact_file_list)
17
+ allow(PactBroker::Client::PublishPacts).to receive(:new).and_return(publish_pacts)
18
+ allow(FileList).to receive(:[]).with(pattern).and_return(pact_file_list)
19
19
  end
20
20
 
21
21
  let(:pattern) { "spec/pacts/*.json" }
@@ -30,15 +30,15 @@ module PactBroker::Client
30
30
 
31
31
  context "when pacts are succesfully published" do
32
32
  it "invokes PublishPacts with the default values" do
33
- PactBroker::Client::PublishPacts.should_receive(:new).with('http://pact-broker', pact_file_list, '1.2.3', nil, {}).and_return(publish_pacts)
34
- publish_pacts.should_receive(:call).and_return(true)
33
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, '1.2.3', [], {}).and_return(publish_pacts)
34
+ expect(publish_pacts).to receive(:call).and_return(true)
35
35
  Rake::Task['pact:publish'].execute
36
36
  end
37
37
  end
38
38
 
39
39
  context "when a pact fails to be published" do
40
40
  it "raises an error" do
41
- publish_pacts.should_receive(:call).and_return(false)
41
+ expect(publish_pacts).to receive(:call).and_return(false)
42
42
  expect { Rake::Task['pact:publish'].execute }.to raise_error("One or more pacts failed to be published")
43
43
  end
44
44
  end
@@ -53,8 +53,8 @@ module PactBroker::Client
53
53
  end
54
54
 
55
55
  it "invokes PublishPacts with the write method set" do
56
- PactBroker::Client::PublishPacts.should_receive(:new).with('http://pact-broker', pact_file_list, '1.2.3', nil, {write: :merge}).and_return(publish_pacts)
57
- publish_pacts.should_receive(:call).and_return(true)
56
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, '1.2.3', [], {write: :merge}).and_return(publish_pacts)
57
+ expect(publish_pacts).to receive(:call).and_return(true)
58
58
  Rake::Task['pact:publish:merge'].execute
59
59
  end
60
60
  end
@@ -78,8 +78,8 @@ module PactBroker::Client
78
78
  let(:pattern) { @pattern }
79
79
 
80
80
  it "invokes PublishPacts with the customised values" do
81
- PactBroker::Client::PublishPacts.should_receive(:new).with(@pact_broker_base_url, pact_file_list, '1.2.3', @tag, {basic_auth: @pact_broker_basic_auth})
82
- publish_pacts.should_receive(:call).and_return(true)
81
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(@pact_broker_base_url, pact_file_list, '1.2.3', [@tag], {basic_auth: @pact_broker_basic_auth})
82
+ expect(publish_pacts).to receive(:call).and_return(true)
83
83
  Rake::Task['pact:publish:custom'].execute
84
84
  end
85
85
  end
@@ -5,12 +5,28 @@ module PactBroker
5
5
  let(:client_options) do
6
6
  { some_option: 'option value'}
7
7
  end
8
- let(:base_url) { 'https://blah' }
8
+ let(:base_url) { 'http://blah' }
9
+ let(:pacticipant_name) { 'Foo' }
10
+ let(:version_number) { '1.2.3' }
11
+
12
+ subject { Versions.new(base_url: base_url, client_options: client_options) }
9
13
 
10
14
  describe 'pacts' do
11
15
  it 'initializes versions with base url and client options' do
12
16
  expect(PactBroker::Client::Pacts).to receive(:new).with(base_url: base_url, client_options: client_options)
13
- Versions.new(base_url: base_url, client_options: client_options).pacts
17
+ subject.pacts
18
+ end
19
+ end
20
+
21
+ describe 'tag' do
22
+ context "when the tag has a / in it" do
23
+ let(:tag) { 'feat/foo' }
24
+ let!(:request) { stub_request(:put, "http://blah/pacticipants/Foo/versions/1.2.3/tags/feat%2Ffoo").to_return(status: 200) }
25
+
26
+ it "URL encodes the /" do
27
+ subject.tag(pacticipant: pacticipant_name, version: version_number, tag: tag)
28
+ expect(request).to have_been_made
29
+ end
14
30
  end
15
31
  end
16
32
  end
@@ -166,9 +166,6 @@
166
166
  },
167
167
  "versions": {
168
168
  "href": "http://example.org/pacticipants/Pricing%20Service/versions"
169
- },
170
- "latest-version": {
171
- "href": "http://example.org/pacticipants/Pricing%20Service/versions/latest"
172
169
  }
173
170
  },
174
171
  "name": "Pricing Service",
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'rspec/fire'
2
+ require 'webmock/rspec'
3
+
4
+ WebMock.disable_net_connect!(allow_localhost: true)
2
5
 
3
6
  RSpec.configure do | config |
4
7
  config.include RSpec::Fire
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "_links": {
3
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" }
4
+ "versions": { "href": "http://example.org/pacticipants/Pricing%20Service/versions" }
6
5
  },
7
6
  "name" : "Pricing Service",
8
7
  "repositoryUrl": "git@git.realestate.com.au:business-systems/pricing-service",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-03 00:00:00.000000000 Z
11
+ date: 2017-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pact
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 10.0.3
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 10.0.3
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: pry
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +122,34 @@ dependencies:
136
122
  - - ">="
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: conventional-changelog
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: Publishes pacts to, and retrieves pacts from, the pact broker server.
140
154
  email:
141
155
  - bskurrie@dius.com.au