pact 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ Do this to generate your change history
2
2
 
3
3
  git log --pretty=format:' * %h - %s (%an, %ad)'
4
4
 
5
+ ### 1.3.2 (20 August 2014)
6
+
7
+ * 65e1e23 - Renamed memoised :options to :diff_options because it clashes with the HTTP options method (bethesque, Wed Aug 20 09:31:0
8
+ * ca883a8 - Made options optional for ConsumerContactBuilder.wait_for_interactions (bethesque, Mon Aug 18 15:53:47 2014 +1000)
9
+
5
10
  ### 1.3.1 (11 August 2014)
6
11
 
7
12
  * 3432259 - Fixed 'pact:verify broken with rspec-core 3.0.3' https://github.com/realestate-com-au/pact/issues/44 (bethesque, Mon Aug 11 10:14:42 2014 +1000)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pact (1.3.1)
4
+ pact (1.3.2)
5
5
  awesome_print (~> 1.1)
6
6
  find_a_port (~> 1.0.1)
7
7
  json
@@ -50,21 +50,21 @@ GEM
50
50
  rspec-core (~> 3.0.0)
51
51
  rspec-expectations (~> 3.0.0)
52
52
  rspec-mocks (~> 3.0.0)
53
- rspec-core (3.0.3)
53
+ rspec-core (3.0.4)
54
54
  rspec-support (~> 3.0.0)
55
- rspec-expectations (3.0.3)
55
+ rspec-expectations (3.0.4)
56
56
  diff-lcs (>= 1.2.0, < 2.0)
57
57
  rspec-support (~> 3.0.0)
58
- rspec-mocks (3.0.3)
58
+ rspec-mocks (3.0.4)
59
59
  rspec-support (~> 3.0.0)
60
- rspec-support (3.0.3)
60
+ rspec-support (3.0.4)
61
61
  safe_yaml (1.0.3)
62
62
  slop (3.5.0)
63
63
  term-ansicolor (1.3.0)
64
64
  tins (~> 1.0)
65
65
  thor (0.19.1)
66
66
  thread_safe (0.3.4)
67
- tins (1.3.0)
67
+ tins (1.3.2)
68
68
  tzinfo (1.2.1)
69
69
  thread_safe (~> 0.1)
70
70
  webmock (1.18.0)
@@ -55,7 +55,7 @@ module Pact
55
55
  mock_service_client.write_pact @consumer_contract_details
56
56
  end
57
57
 
58
- def wait_for_interactions options
58
+ def wait_for_interactions options = {}
59
59
  wait_max_seconds = options.fetch(:wait_max_seconds, 3)
60
60
  poll_interval = options.fetch(:poll_interval, 0.1)
61
61
  mock_service_client.wait_for_interactions wait_max_seconds, poll_interval
@@ -71,54 +71,6 @@ module Pact
71
71
  attr_reader :mock_service_client
72
72
  attr_writer :interaction_builder
73
73
 
74
- # def interactions_for_new_consumer_contract pactfile_write_mode
75
- # pactfile_write_mode == :update ? existing_interactions : []
76
- # end
77
-
78
- # def filter interactions, pactfile_write_mode
79
- # if pactfile_write_mode == :update
80
- # UpdatableInteractionsFilter.new(interactions)
81
- # else
82
- # DistinctInteractionsFilter.new(interactions)
83
- # end
84
- # end
85
-
86
- # def warn_and_stderr msg
87
- # Pact.configuration.error_stream.puts msg
88
- # logger.warn msg
89
- # end
90
-
91
- # def info_and_puts msg
92
- # $stdout.puts msg
93
- # logger.info msg
94
- # end
95
-
96
- # def existing_interactions
97
- # interactions = []
98
- # if pactfile_exists?
99
- # begin
100
- # interactions = existing_consumer_contract.interactions
101
- # info_and_puts "*****************************************************************************"
102
- # info_and_puts "Updating existing file .#{consumer_contract.pactfile_path.gsub(Dir.pwd, '')} as config.pactfile_write_mode is :update"
103
- # info_and_puts "Only interactions defined in this test run will be updated."
104
- # info_and_puts "As interactions are identified by description and provider state, pleased note that if either of these have changed, the old interactions won't be removed from the pact file until the specs are next run with :pactfile_write_mode => :overwrite."
105
- # info_and_puts "*****************************************************************************"
106
- # rescue StandardError => e
107
- # warn_and_stderr "Could not load existing consumer contract from #{consumer_contract.pactfile_path} due to #{e}"
108
- # warn_and_stderr "Creating a new file."
109
- # end
110
- # end
111
- # interactions
112
- # end
113
-
114
- # def pactfile_exists?
115
- # File.exist?(consumer_contract.pactfile_path)
116
- # end
117
-
118
- # def existing_consumer_contract
119
- # Pact::ConsumerContract.from_uri(consumer_contract.pactfile_path)
120
- # end
121
-
122
74
  end
123
75
  end
124
76
  end
@@ -111,7 +111,7 @@ module Pact
111
111
  let(:expected_content_type) { Pact::Headers.new(expected_response['headers'] || {})['Content-Type'] }
112
112
  let(:actual_content_type) { response.headers['Content-Type']}
113
113
  let(:diff_content_type) { String === expected_content_type ? expected_content_type : actual_content_type } # expected_content_type may be a Regexp
114
- let(:options) { { with: differ, diff_formatter: diff_formatter } }
114
+ let(:diff_options) { { with: differ, diff_formatter: diff_formatter } }
115
115
 
116
116
  if expected_response['status']
117
117
  it "has status code #{expected_response['status']}" do
@@ -132,7 +132,7 @@ module Pact
132
132
 
133
133
  if expected_response['body']
134
134
  it "has a matching body" do
135
- expect(response_body).to match_term expected_response_body, options
135
+ expect(response_body).to match_term expected_response_body, diff_options
136
136
  end
137
137
  end
138
138
  end
data/lib/pact/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pact
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -0,0 +1,21 @@
1
+ {
2
+ "consumer": {
3
+ "name": "Consumer"
4
+ },
5
+ "provider": {
6
+ "name": "Provider"
7
+ },
8
+ "interactions": [
9
+ {
10
+ "description": "an OPTIONS request",
11
+ "request": {
12
+ "method": "options",
13
+ "path": "/"
14
+ },
15
+ "response": {
16
+ "status": 200
17
+ },
18
+ "provider_state": null
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,15 @@
1
+ require 'pact/provider/rspec'
2
+
3
+ class App
4
+ def self.call env
5
+ if env['REQUEST_METHOD'] == 'OPTIONS'
6
+ [200, {}, []]
7
+ else
8
+ [500, {}, ["Expected an options request"]]
9
+ end
10
+ end
11
+ end
12
+
13
+ Pact.service_provider 'Provider' do
14
+ app { App }
15
+ end
data/tasks/pact-test.rake CHANGED
@@ -5,6 +5,10 @@ Pact::VerificationTask.new(:stubbing) do | pact |
5
5
  pact.uri './spec/support/stubbing.json', :pact_helper => './spec/support/stubbing_using_allow.rb'
6
6
  end
7
7
 
8
+ Pact::VerificationTask.new(:options) do | pact |
9
+ pact.uri './spec/support/options.json', :pact_helper => './spec/support/options_app.rb'
10
+ end
11
+
8
12
  Pact::VerificationTask.new(:pass) do | pact |
9
13
  pact.uri './spec/support/test_app_pass.json'
10
14
  end
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.3.1
4
+ version: 1.3.2
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: 2014-08-11 00:00:00.000000000 Z
16
+ date: 2014-08-19 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: randexp
@@ -532,6 +532,8 @@ files:
532
532
  - spec/support/interaction_view_model_with_terms.json
533
533
  - spec/support/markdown_pact.json
534
534
  - spec/support/missing_provider_states_output.txt
535
+ - spec/support/options.json
536
+ - spec/support/options_app.rb
535
537
  - spec/support/pact_helper.rb
536
538
  - spec/support/shared_examples_for_request.rb
537
539
  - spec/support/spec_support.rb
@@ -558,7 +560,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
558
560
  version: '0'
559
561
  segments:
560
562
  - 0
561
- hash: 1965962411134089782
563
+ hash: -3697299514790813108
562
564
  required_rubygems_version: !ruby/object:Gem::Requirement
563
565
  none: false
564
566
  requirements:
@@ -567,7 +569,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
567
569
  version: '0'
568
570
  segments:
569
571
  - 0
570
- hash: 1965962411134089782
572
+ hash: -3697299514790813108
571
573
  requirements: []
572
574
  rubyforge_project:
573
575
  rubygems_version: 1.8.23
@@ -664,6 +666,8 @@ test_files:
664
666
  - spec/support/interaction_view_model_with_terms.json
665
667
  - spec/support/markdown_pact.json
666
668
  - spec/support/missing_provider_states_output.txt
669
+ - spec/support/options.json
670
+ - spec/support/options_app.rb
667
671
  - spec/support/pact_helper.rb
668
672
  - spec/support/shared_examples_for_request.rb
669
673
  - spec/support/spec_support.rb