pact-mock_service 0.2.2 → 0.2.3.pre.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/pact/consumer/app_manager.rb +5 -1
  4. data/lib/pact/consumer/interactions_filter.rb +1 -17
  5. data/lib/pact/consumer/mock_service/actual_interactions.rb +34 -0
  6. data/lib/pact/consumer/mock_service/app.rb +21 -18
  7. data/lib/pact/consumer/mock_service/candidate_interactions.rb +13 -0
  8. data/lib/pact/consumer/mock_service/expected_interactions.rb +17 -0
  9. data/lib/pact/consumer/mock_service/interaction_delete.rb +11 -5
  10. data/lib/pact/consumer/mock_service/interaction_post.rb +69 -6
  11. data/lib/pact/consumer/mock_service/interaction_replay.rb +77 -57
  12. data/lib/pact/consumer/mock_service/log_get.rb +1 -1
  13. data/lib/pact/consumer/mock_service/missing_interactions_get.rb +7 -4
  14. data/lib/pact/consumer/mock_service/pact_post.rb +6 -4
  15. data/lib/pact/consumer/mock_service/rack_request_helper.rb +1 -1
  16. data/lib/pact/consumer/mock_service/verification.rb +46 -0
  17. data/lib/pact/consumer/mock_service/verification_get.rb +17 -12
  18. data/lib/pact/consumer/mock_service/verified_interactions.rb +18 -0
  19. data/lib/pact/consumer/mock_service_client.rb +4 -4
  20. data/lib/pact/consumer/server.rb +2 -0
  21. data/lib/pact/consumer_contract/consumer_contract_writer.rb +2 -0
  22. data/lib/pact/mock_service/cli.rb +21 -14
  23. data/lib/pact/mock_service/version.rb +1 -1
  24. metadata +10 -124
  25. data/.gitignore +0 -30
  26. data/.rspec +0 -3
  27. data/.travis.yml +0 -8
  28. data/Rakefile +0 -6
  29. data/lib/pact/consumer/mock_service/interaction_list.rb +0 -76
  30. data/pact-mock-service.gemspec +0 -39
  31. data/spec/features/mock_multiple_responses_spec.rb +0 -120
  32. data/spec/features/mock_response_spec.rb +0 -71
  33. data/spec/lib/pact/consumer/app_manager_spec.rb +0 -42
  34. data/spec/lib/pact/consumer/mock_service/app_spec.rb +0 -52
  35. data/spec/lib/pact/consumer/mock_service/interaction_list_spec.rb +0 -78
  36. data/spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb +0 -70
  37. data/spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb +0 -12
  38. data/spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb +0 -88
  39. data/spec/lib/pact/consumer/mock_service/verification_get_spec.rb +0 -142
  40. data/spec/lib/pact/consumer/mock_service_client_spec.rb +0 -88
  41. data/spec/lib/pact/consumer/service_consumer_spec.rb +0 -11
  42. data/spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb +0 -128
  43. data/spec/lib/pact/consumer_contract/request_decorator_body_spec.rb +0 -77
  44. data/spec/lib/pact/consumer_contract/request_decorator_headers_spec.rb +0 -69
  45. data/spec/lib/pact/consumer_contract/request_decorator_path_spec.rb +0 -42
  46. data/spec/lib/pact/consumer_contract/request_decorator_query_spec.rb +0 -74
  47. data/spec/lib/pact/consumer_contract/request_decorator_spec.rb +0 -41
  48. data/spec/lib/pact/consumer_contract/response_decorator_spec.rb +0 -10
  49. data/spec/lib/pact/mock_service/interaction_decorator_spec.rb +0 -74
  50. data/spec/lib/pact/mock_service/request_decorator_spec.rb +0 -76
  51. data/spec/lib/pact/mock_service/response_decorator_spec.rb +0 -12
  52. data/spec/spec_helper.rb +0 -16
  53. data/spec/support/a_consumer-a_producer.json +0 -32
  54. data/spec/support/a_consumer-a_provider.json +0 -32
  55. data/spec/support/active_support_if_configured.rb +0 -6
  56. data/spec/support/app_for_config_ru.rb +0 -4
  57. data/spec/support/case-insensitive-response-header-matching.json +0 -21
  58. data/spec/support/case-insensitive-response-header-matching.rb +0 -15
  59. data/spec/support/consumer_contract_template.json +0 -24
  60. data/spec/support/dsl_spec_support.rb +0 -7
  61. data/spec/support/factories.rb +0 -82
  62. data/spec/support/generated_index.md +0 -4
  63. data/spec/support/generated_markdown.md +0 -55
  64. data/spec/support/interaction_view_model.json +0 -63
  65. data/spec/support/interaction_view_model_with_terms.json +0 -50
  66. data/spec/support/markdown_pact.json +0 -48
  67. data/spec/support/missing_provider_states_output.txt +0 -25
  68. data/spec/support/options.json +0 -21
  69. data/spec/support/options_app.rb +0 -15
  70. data/spec/support/pact_helper.rb +0 -57
  71. data/spec/support/shared_examples_for_request.rb +0 -94
  72. data/spec/support/shared_examples_for_response_decorator.rb +0 -25
  73. data/spec/support/spec_support.rb +0 -20
  74. data/spec/support/stubbing.json +0 -22
  75. data/spec/support/stubbing_using_allow.rb +0 -29
  76. data/spec/support/term.json +0 -48
  77. data/spec/support/test_app_fail.json +0 -61
  78. data/spec/support/test_app_pass.json +0 -38
  79. data/spec/support/test_app_with_right_content_type_differ.json +0 -23
  80. data/tasks/spec.rake +0 -6
@@ -0,0 +1,46 @@
1
+ module Pact
2
+ module Consumer
3
+ class Verification
4
+
5
+ def initialize expected_interactions, actual_interactions
6
+ @expected_interactions = expected_interactions
7
+ @actual_interactions = actual_interactions
8
+ end
9
+
10
+ def all_matched?
11
+ interaction_diffs.empty?
12
+ end
13
+
14
+ def interaction_diffs
15
+ {
16
+ :missing_interactions => missing_interactions_summaries,
17
+ :interaction_mismatches => interaction_mismatches_summaries,
18
+ :unexpected_requests => unexpected_requests_summaries
19
+ }.each_with_object({}) do | (key, value), hash |
20
+ hash[key] = value if value.any?
21
+ end
22
+ end
23
+
24
+ def missing_interactions_summaries
25
+ missing_interactions.collect(&:request).collect(&:method_and_path)
26
+ end
27
+
28
+ def interaction_mismatches_summaries
29
+ actual_interactions.interaction_mismatches.collect(&:short_summary)
30
+ end
31
+
32
+ def unexpected_requests_summaries
33
+ actual_interactions.unexpected_requests.collect(&:method_and_path)
34
+ end
35
+
36
+ def missing_interactions
37
+ expected_interactions - actual_interactions.matched_interactions - @actual_interactions.interaction_mismatches.collect(&:candidate_interactions).flatten
38
+ end
39
+
40
+ private
41
+
42
+ attr_reader :expected_interactions, :actual_interactions
43
+
44
+ end
45
+ end
46
+ end
@@ -5,11 +5,11 @@ module Pact
5
5
  class VerificationGet < MockServiceAdministrationEndpoint
6
6
 
7
7
  include RackRequestHelper
8
- attr_accessor :interaction_list, :log_description
9
8
 
10
- def initialize name, logger, interaction_list, log_description
9
+ def initialize name, logger, expected_interactions, actual_interactions, log_description
11
10
  super name, logger
12
- @interaction_list = interaction_list
11
+ @expected_interactions = expected_interactions
12
+ @actual_interactions = actual_interactions
13
13
  @log_description = log_description
14
14
  end
15
15
 
@@ -22,25 +22,30 @@ module Pact
22
22
  end
23
23
 
24
24
  def respond env
25
- if interaction_list.all_matched?
25
+ verification = Verification.new(expected_interactions, actual_interactions)
26
+ if verification.all_matched?
26
27
  logger.info "Verifying - interactions matched for example \"#{example_description(env)}\""
27
28
  [200, {'Content-Type' => 'text/plain'}, ['Interactions matched']]
28
29
  else
29
- error_message = FailureMessage.new(interaction_list).to_s
30
+ error_message = FailureMessage.new(verification).to_s
30
31
  logger.warn "Verifying - actual interactions do not match expected interactions for example \"#{example_description(env)}\". \n#{error_message}"
31
32
  logger.warn error_message
32
33
  [500, {'Content-Type' => 'text/plain'}, ["Actual interactions do not match expected interactions for mock #{name}.\n\n#{error_message}See #{log_description} for details."]]
33
34
  end
34
35
  end
35
36
 
37
+ private
38
+
39
+ attr_accessor :expected_interactions, :actual_interactions, :log_description
40
+
36
41
  def example_description env
37
- params_hash(env)['example_description']
42
+ params_hash(env).fetch("example_description", [])[0]
38
43
  end
39
44
 
40
45
  class FailureMessage
41
46
 
42
- def initialize interaction_list
43
- @interaction_list = interaction_list
47
+ def initialize verification
48
+ @verification = verification
44
49
  end
45
50
 
46
51
  def to_s
@@ -52,13 +57,13 @@ module Pact
52
57
 
53
58
  private
54
59
 
55
- attr_reader :interaction_list
60
+ attr_reader :verification
56
61
 
57
62
  def titles_and_summaries
58
63
  {
59
- "Incorrect requests" => interaction_list.interaction_mismatches_summaries,
60
- "Missing requests" => interaction_list.missing_interactions_summaries,
61
- "Unexpected requests" => interaction_list.unexpected_requests_summaries,
64
+ "Incorrect requests" => verification.interaction_mismatches_summaries,
65
+ "Missing requests" => verification.missing_interactions_summaries,
66
+ "Unexpected requests" => verification.unexpected_requests_summaries,
62
67
  }
63
68
  end
64
69
 
@@ -0,0 +1,18 @@
1
+ module Pact
2
+ module Consumer
3
+ class VerifiedInteractions < Array
4
+
5
+ def << interaction
6
+ unless find_matching_description_and_provider_state interaction
7
+ super
8
+ end
9
+ end
10
+
11
+ def find_matching_description_and_provider_state interaction
12
+ find do |candidate_interaction|
13
+ candidate_interaction.matches_criteria?(description: interaction.description, provider_state: interaction.provider_state)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -12,12 +12,12 @@ module Pact
12
12
  end
13
13
 
14
14
  def verify example_description
15
- response = http.request_get("/interactions/verification?example_description=#{URI.encode(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
15
+ response = http.request_get("/interactions/verification?example_description=#{CGI.escape(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
16
16
  raise "\e[31m#{response.body}\e[m" unless response.is_a? Net::HTTPSuccess
17
17
  end
18
18
 
19
19
  def log msg
20
- http.request_get("/log?msg=#{URI.encode(msg)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
20
+ http.request_get("/log?msg=#{CGI.escape(msg)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
21
21
  end
22
22
 
23
23
  def wait_for_interactions wait_max_seconds, poll_interval
@@ -28,7 +28,7 @@ module Pact
28
28
  end
29
29
 
30
30
  def clear_interactions example_description
31
- http.delete("/interactions?example_description=#{URI.encode(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
31
+ http.delete("/interactions?example_description=#{CGI.escape(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
32
32
  end
33
33
 
34
34
  def add_expected_interaction interaction
@@ -41,7 +41,7 @@ module Pact
41
41
  end
42
42
 
43
43
  def self.clear_interactions port, example_description
44
- Net::HTTP.new("localhost", port).delete("/interactions?example_description=#{URI.encode(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
44
+ Net::HTTP.new("localhost", port).delete("/interactions?example_description=#{CGI.escape(example_description)}", MOCK_SERVICE_ADMINISTRATON_HEADERS)
45
45
  end
46
46
 
47
47
  def write_pact pacticipant_details
@@ -63,6 +63,8 @@ module Pact
63
63
  end
64
64
  rescue SystemCallError
65
65
  return false
66
+ rescue EOFError
67
+ return false
66
68
  end
67
69
 
68
70
  def run_default_server(app, port)
@@ -4,6 +4,7 @@ require 'pact/consumer_contract/file_name'
4
4
  require 'pact/consumer_contract/pact_file'
5
5
  require 'pact/consumer_contract/consumer_contract_decorator'
6
6
  require 'pact/shared/active_support_support'
7
+ require 'fileutils'
7
8
 
8
9
  module Pact
9
10
 
@@ -45,6 +46,7 @@ module Pact
45
46
 
46
47
  def update_pactfile
47
48
  logger.debug "Updating pact file for #{provider_name} at #{pactfile_path}"
49
+ FileUtils.mkdir_p File.dirname(pactfile_path)
48
50
  File.open(pactfile_path, 'w') do |f|
49
51
  f.write pact_json
50
52
  end
@@ -1,47 +1,54 @@
1
1
  require 'find_a_port'
2
2
  require 'thor'
3
3
  require 'thwait'
4
+ require 'webrick/https'
4
5
  require 'rack/handler/webrick'
5
-
6
- # TODO rename CLI so as not to clash
6
+ require 'fileutils'
7
7
 
8
8
  module Pact
9
9
  module MockService
10
10
  class CLI < Thor
11
11
 
12
- desc 'service', "Start a mock service"
12
+ desc 'execute', "Start a mock service"
13
13
  method_option :port, aliases: "-p", desc: "Port on which to run the service"
14
+ method_option :ssl, desc: "Use a self-signed SSL cert to run the service over HTTPS"
14
15
  method_option :log, aliases: "-l", desc: "File to which to log output"
15
- method_option :quiet, aliases: "-q", desc: "If true, no admin messages will be shown"
16
+ method_option :pact_dir, aliases: "-d", desc: "Directory to which the pacts will be written"
16
17
 
17
- def service
18
+ def execute
18
19
  RunStandaloneMockService.call(options)
19
20
  end
20
21
 
21
- default_task :service
22
-
23
- private
22
+ default_task :execute
24
23
 
25
- def log message
26
- puts message unless options[:quiet]
27
- end
28
24
  end
29
25
 
30
26
  class RunStandaloneMockService
31
27
 
32
28
  def self.call options
33
29
  require 'pact/consumer/mock_service/app'
34
- service_options = {}
30
+ service_options = {pact_dir: options[:pact_dir]}
35
31
  if options[:log]
32
+ FileUtils.mkdir_p File.dirname(options[:log])
36
33
  log = File.open(options[:log], 'w')
37
34
  log.sync = true
38
35
  service_options[:log_file] = log
39
36
  end
40
37
 
41
- port = options[:port] || FindAPort.available_port
42
38
  mock_service = Pact::Consumer::MockService.new(service_options)
43
39
  trap(:INT) { Rack::Handler::WEBrick.shutdown }
44
- Rack::Handler::WEBrick.run(mock_service, :Port => port, :AccessLog => [])
40
+ trap(:TERM) { Rack::Handler::WEBrick.shutdown }
41
+
42
+ webbrick_opts = {
43
+ :Port => options[:port] || FindAPort.available_port,
44
+ :AccessLog => []
45
+ }
46
+
47
+ webbrick_opts.merge!({
48
+ :SSLEnable => true,
49
+ :SSLCertName => [ %w[CN localhost] ] }) if options[:ssl]
50
+
51
+ Rack::Handler::WEBrick.run(mock_service, webbrick_opts)
45
52
  end
46
53
  end
47
54
 
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module MockService
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3-rc1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-mock_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3.pre.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-10-28 00:00:00.000000000 Z
15
+ date: 2015-01-03 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -70,20 +70,6 @@ dependencies:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 0.6.2
73
- - !ruby/object:Gem::Dependency
74
- name: awesome_print
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '1.1'
80
- type: :runtime
81
- prerelease: false
82
- version_requirements: !ruby/object:Gem::Requirement
83
- requirements:
84
- - - "~>"
85
- - !ruby/object:Gem::Version
86
- version: '1.1'
87
73
  - !ruby/object:Gem::Dependency
88
74
  name: thor
89
75
  requirement: !ruby/object:Gem::Requirement
@@ -264,21 +250,19 @@ executables:
264
250
  extensions: []
265
251
  extra_rdoc_files: []
266
252
  files:
267
- - ".gitignore"
268
- - ".rspec"
269
- - ".travis.yml"
270
253
  - CHANGELOG.md
271
254
  - Gemfile
272
255
  - LICENSE.txt
273
256
  - README.md
274
- - Rakefile
275
257
  - bin/pact-mock-service
276
258
  - lib/pact/consumer/app_manager.rb
277
259
  - lib/pact/consumer/interactions_filter.rb
278
260
  - lib/pact/consumer/mock_service.rb
261
+ - lib/pact/consumer/mock_service/actual_interactions.rb
279
262
  - lib/pact/consumer/mock_service/app.rb
263
+ - lib/pact/consumer/mock_service/candidate_interactions.rb
264
+ - lib/pact/consumer/mock_service/expected_interactions.rb
280
265
  - lib/pact/consumer/mock_service/interaction_delete.rb
281
- - lib/pact/consumer/mock_service/interaction_list.rb
282
266
  - lib/pact/consumer/mock_service/interaction_mismatch.rb
283
267
  - lib/pact/consumer/mock_service/interaction_post.rb
284
268
  - lib/pact/consumer/mock_service/interaction_replay.rb
@@ -287,7 +271,9 @@ files:
287
271
  - lib/pact/consumer/mock_service/mock_service_administration_endpoint.rb
288
272
  - lib/pact/consumer/mock_service/pact_post.rb
289
273
  - lib/pact/consumer/mock_service/rack_request_helper.rb
274
+ - lib/pact/consumer/mock_service/verification.rb
290
275
  - lib/pact/consumer/mock_service/verification_get.rb
276
+ - lib/pact/consumer/mock_service/verified_interactions.rb
291
277
  - lib/pact/consumer/mock_service_client.rb
292
278
  - lib/pact/consumer/server.rb
293
279
  - lib/pact/consumer_contract/consumer_contract_decorator.rb
@@ -301,57 +287,6 @@ files:
301
287
  - lib/pact/mock_service/request_decorator.rb
302
288
  - lib/pact/mock_service/response_decorator.rb
303
289
  - lib/pact/mock_service/version.rb
304
- - pact-mock-service.gemspec
305
- - spec/features/mock_multiple_responses_spec.rb
306
- - spec/features/mock_response_spec.rb
307
- - spec/lib/pact/consumer/app_manager_spec.rb
308
- - spec/lib/pact/consumer/mock_service/app_spec.rb
309
- - spec/lib/pact/consumer/mock_service/interaction_list_spec.rb
310
- - spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb
311
- - spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb
312
- - spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb
313
- - spec/lib/pact/consumer/mock_service/verification_get_spec.rb
314
- - spec/lib/pact/consumer/mock_service_client_spec.rb
315
- - spec/lib/pact/consumer/service_consumer_spec.rb
316
- - spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb
317
- - spec/lib/pact/consumer_contract/request_decorator_body_spec.rb
318
- - spec/lib/pact/consumer_contract/request_decorator_headers_spec.rb
319
- - spec/lib/pact/consumer_contract/request_decorator_path_spec.rb
320
- - spec/lib/pact/consumer_contract/request_decorator_query_spec.rb
321
- - spec/lib/pact/consumer_contract/request_decorator_spec.rb
322
- - spec/lib/pact/consumer_contract/response_decorator_spec.rb
323
- - spec/lib/pact/mock_service/interaction_decorator_spec.rb
324
- - spec/lib/pact/mock_service/request_decorator_spec.rb
325
- - spec/lib/pact/mock_service/response_decorator_spec.rb
326
- - spec/spec_helper.rb
327
- - spec/support/a_consumer-a_producer.json
328
- - spec/support/a_consumer-a_provider.json
329
- - spec/support/active_support_if_configured.rb
330
- - spec/support/app_for_config_ru.rb
331
- - spec/support/case-insensitive-response-header-matching.json
332
- - spec/support/case-insensitive-response-header-matching.rb
333
- - spec/support/consumer_contract_template.json
334
- - spec/support/dsl_spec_support.rb
335
- - spec/support/factories.rb
336
- - spec/support/generated_index.md
337
- - spec/support/generated_markdown.md
338
- - spec/support/interaction_view_model.json
339
- - spec/support/interaction_view_model_with_terms.json
340
- - spec/support/markdown_pact.json
341
- - spec/support/missing_provider_states_output.txt
342
- - spec/support/options.json
343
- - spec/support/options_app.rb
344
- - spec/support/pact_helper.rb
345
- - spec/support/shared_examples_for_request.rb
346
- - spec/support/shared_examples_for_response_decorator.rb
347
- - spec/support/spec_support.rb
348
- - spec/support/stubbing.json
349
- - spec/support/stubbing_using_allow.rb
350
- - spec/support/term.json
351
- - spec/support/test_app_fail.json
352
- - spec/support/test_app_pass.json
353
- - spec/support/test_app_with_right_content_type_differ.json
354
- - tasks/spec.rake
355
290
  homepage: https://github.com/bethesque/pact-mock_service
356
291
  licenses:
357
292
  - MIT
@@ -367,62 +302,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
302
  version: '0'
368
303
  required_rubygems_version: !ruby/object:Gem::Requirement
369
304
  requirements:
370
- - - ">="
305
+ - - ">"
371
306
  - !ruby/object:Gem::Version
372
- version: '0'
307
+ version: 1.3.1
373
308
  requirements: []
374
309
  rubyforge_project:
375
310
  rubygems_version: 2.2.2
376
311
  signing_key:
377
312
  specification_version: 4
378
313
  summary: Provides a mock service for use with Pact
379
- test_files:
380
- - spec/features/mock_multiple_responses_spec.rb
381
- - spec/features/mock_response_spec.rb
382
- - spec/lib/pact/consumer/app_manager_spec.rb
383
- - spec/lib/pact/consumer/mock_service/app_spec.rb
384
- - spec/lib/pact/consumer/mock_service/interaction_list_spec.rb
385
- - spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb
386
- - spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb
387
- - spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb
388
- - spec/lib/pact/consumer/mock_service/verification_get_spec.rb
389
- - spec/lib/pact/consumer/mock_service_client_spec.rb
390
- - spec/lib/pact/consumer/service_consumer_spec.rb
391
- - spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb
392
- - spec/lib/pact/consumer_contract/request_decorator_body_spec.rb
393
- - spec/lib/pact/consumer_contract/request_decorator_headers_spec.rb
394
- - spec/lib/pact/consumer_contract/request_decorator_path_spec.rb
395
- - spec/lib/pact/consumer_contract/request_decorator_query_spec.rb
396
- - spec/lib/pact/consumer_contract/request_decorator_spec.rb
397
- - spec/lib/pact/consumer_contract/response_decorator_spec.rb
398
- - spec/lib/pact/mock_service/interaction_decorator_spec.rb
399
- - spec/lib/pact/mock_service/request_decorator_spec.rb
400
- - spec/lib/pact/mock_service/response_decorator_spec.rb
401
- - spec/spec_helper.rb
402
- - spec/support/a_consumer-a_producer.json
403
- - spec/support/a_consumer-a_provider.json
404
- - spec/support/active_support_if_configured.rb
405
- - spec/support/app_for_config_ru.rb
406
- - spec/support/case-insensitive-response-header-matching.json
407
- - spec/support/case-insensitive-response-header-matching.rb
408
- - spec/support/consumer_contract_template.json
409
- - spec/support/dsl_spec_support.rb
410
- - spec/support/factories.rb
411
- - spec/support/generated_index.md
412
- - spec/support/generated_markdown.md
413
- - spec/support/interaction_view_model.json
414
- - spec/support/interaction_view_model_with_terms.json
415
- - spec/support/markdown_pact.json
416
- - spec/support/missing_provider_states_output.txt
417
- - spec/support/options.json
418
- - spec/support/options_app.rb
419
- - spec/support/pact_helper.rb
420
- - spec/support/shared_examples_for_request.rb
421
- - spec/support/shared_examples_for_response_decorator.rb
422
- - spec/support/spec_support.rb
423
- - spec/support/stubbing.json
424
- - spec/support/stubbing_using_allow.rb
425
- - spec/support/term.json
426
- - spec/support/test_app_fail.json
427
- - spec/support/test_app_pass.json
428
- - spec/support/test_app_with_right_content_type_differ.json
314
+ test_files: []
data/.gitignore DELETED
@@ -1,30 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- InstalledFiles
7
- _yardoc
8
- coverage
9
- lib/bundler/man
10
- pkg
11
- rdoc
12
- spec/reports
13
- test/tmp
14
- test/version_tmp
15
- tmp
16
- *.swp
17
- .bin
18
- tags
19
- .rbenv-version
20
- spec/pacts
21
- .rvmrc
22
- *.iml
23
- .rakeTasks
24
- *~
25
- .ruby-gemset
26
- .ruby-version
27
- log
28
- .idea
29
- reports
30
- Gemfile.lock
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format documentation
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.1
6
- - jruby-19mode
7
- - jruby-1.7.11
8
- - jruby-1.7.12
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- Dir.glob('./lib/tasks/**/*.rake').each { |task| load task }
4
- Dir.glob('./tasks/**/*.rake').each { |task| load task }
5
-
6
-
@@ -1,76 +0,0 @@
1
- module Pact
2
- module Consumer
3
- class InteractionList
4
-
5
- attr_reader :interactions
6
- attr_reader :unexpected_requests
7
- attr_reader :interaction_mismatches
8
-
9
- def initialize
10
- clear
11
- end
12
-
13
- # For testing, sigh
14
- def clear
15
- @interactions = []
16
- @matched_interactions = []
17
- @interaction_mismatches = []
18
- @unexpected_requests = []
19
- end
20
-
21
- def add interactions
22
- @interactions << interactions
23
- end
24
-
25
- def register_matched interaction
26
- @matched_interactions << interaction
27
- end
28
-
29
- def register_unexpected_request request
30
- @unexpected_requests << request
31
- end
32
-
33
- def register_interaction_mismatch interaction_mismatch
34
- @interaction_mismatches << interaction_mismatch
35
- end
36
-
37
- def all_matched?
38
- interaction_diffs.empty?
39
- end
40
-
41
- def missing_interactions
42
- @interactions - @matched_interactions - @interaction_mismatches.collect(&:candidate_interactions).flatten
43
- end
44
-
45
- def missing_interactions_summaries
46
- missing_interactions.collect(&:request).collect(&:method_and_path)
47
- end
48
-
49
- def interaction_mismatches_summaries
50
- interaction_mismatches.collect(&:short_summary)
51
- end
52
-
53
- def unexpected_requests_summaries
54
- unexpected_requests.collect(&:method_and_path)
55
- end
56
-
57
- def interaction_diffs
58
- {
59
- :missing_interactions => missing_interactions_summaries,
60
- :interaction_mismatches => interaction_mismatches_summaries,
61
- :unexpected_requests => unexpected_requests_summaries
62
- }.inject({}) do | hash, pair |
63
- hash[pair.first] = pair.last if pair.last.any?
64
- hash
65
- end
66
- end
67
-
68
- def find_candidate_interactions actual_request
69
- interactions.select do | interaction |
70
- interaction.request.matches_route? actual_request
71
- end
72
- end
73
-
74
- end
75
- end
76
- end
@@ -1,39 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'pact/mock_service/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "pact-mock_service"
8
- gem.version = Pact::MockService::VERSION
9
- gem.authors = ["James Fraser", "Sergei Matheson", "Brent Snook", "Ronald Holshausen", "Beth Skurrie"]
10
- gem.email = ["james.fraser@alumni.swinburne.edu", "sergei.matheson@gmail.com", "brent@fuglylogic.com", "uglyog@gmail.com", "bskurrie@dius.com.au"]
11
- gem.summary = %q{Provides a mock service for use with Pact}
12
- gem.homepage = "https://github.com/bethesque/pact-mock_service"
13
-
14
- gem.files = `git ls-files`.split($/)
15
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
- gem.require_paths = ["lib"]
18
- gem.license = 'MIT'
19
-
20
- gem.add_runtime_dependency 'rack'
21
- gem.add_runtime_dependency 'rspec', '>=2.14'
22
- gem.add_runtime_dependency 'find_a_port', '~> 1.0.1'
23
- gem.add_runtime_dependency 'rack-test', '~> 0.6.2'
24
- gem.add_runtime_dependency 'awesome_print', '~> 1.1'
25
- gem.add_runtime_dependency 'thor'
26
- gem.add_runtime_dependency 'json' #Not locking down a version because buncher gem requires 1.6, while other projects use 1.7.
27
- gem.add_runtime_dependency 'webrick'
28
- gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
29
-
30
- gem.add_runtime_dependency 'pact-support', '~> 0.1.1'
31
-
32
- gem.add_development_dependency 'rake', '~> 10.0.3'
33
- gem.add_development_dependency 'webmock', '~> 1.18.0'
34
- gem.add_development_dependency 'pry'
35
- gem.add_development_dependency 'fakefs', '~> 0.4'
36
- gem.add_development_dependency 'hashie', '~> 2.0'
37
- gem.add_development_dependency 'activesupport'
38
- gem.add_development_dependency 'faraday'
39
- end