pact 1.1.1 → 1.2.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/CHANGELOG.md +7 -0
  2. data/Gemfile.lock +42 -39
  3. data/README.md +2 -0
  4. data/documentation/configuration.md +2 -2
  5. data/documentation/faq.md +5 -7
  6. data/documentation/provider-states.md +2 -10
  7. data/example/animal-service/spec/service_consumers/pact_helper.rb +0 -4
  8. data/lib/pact/consumer/configuration/mock_service.rb +2 -0
  9. data/lib/pact/consumer/consumer_contract_builder.rb +58 -58
  10. data/lib/pact/consumer/mock_service/app.rb +4 -1
  11. data/lib/pact/consumer/mock_service/interaction_replay.rb +11 -3
  12. data/lib/pact/consumer/mock_service/missing_interactions_get.rb +2 -2
  13. data/lib/pact/consumer/mock_service/pact_post.rb +33 -0
  14. data/lib/pact/consumer/mock_service/verification_get.rb +1 -2
  15. data/lib/pact/consumer/mock_service_client.rb +14 -5
  16. data/lib/pact/consumer/mock_service_interaction_expectation.rb +1 -1
  17. data/lib/pact/consumer/spec_hooks.rb +2 -0
  18. data/lib/pact/consumer/world.rb +25 -0
  19. data/lib/pact/consumer_contract/consumer_contract.rb +1 -1
  20. data/lib/pact/consumer_contract/consumer_contract_writer.rb +84 -0
  21. data/lib/pact/consumer_contract/file_name.rb +7 -1
  22. data/lib/pact/provider/pact_helper_locator.rb +1 -1
  23. data/lib/pact/provider/pact_spec_runner.rb +3 -9
  24. data/lib/pact/provider/rspec/{formatter.rb → formatter_rspec_2.rb} +2 -2
  25. data/lib/pact/provider/rspec/formatter_rspec_3.rb +96 -0
  26. data/lib/pact/provider/rspec/matchers.rb +79 -19
  27. data/lib/pact/provider/rspec.rb +3 -1
  28. data/lib/pact/provider/state/provider_state_configured_modules.rb +6 -0
  29. data/lib/pact/provider/state/provider_state_manager.rb +3 -3
  30. data/lib/pact/provider/world.rb +2 -8
  31. data/lib/pact/rspec.rb +32 -0
  32. data/lib/pact/version.rb +1 -1
  33. data/pact.gemspec +3 -3
  34. data/spec/features/consumption_spec.rb +6 -1
  35. data/spec/integration/consumer_spec.rb +16 -9
  36. data/spec/integration/pact/consumer_configuration_spec.rb +7 -22
  37. data/spec/lib/pact/app_spec.rb +5 -5
  38. data/spec/lib/pact/configuration_spec.rb +1 -1
  39. data/spec/lib/pact/consumer/app_manager_spec.rb +3 -3
  40. data/spec/lib/pact/consumer/configuration_spec.rb +11 -8
  41. data/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +3 -101
  42. data/spec/lib/pact/consumer/interaction_builder_spec.rb +8 -8
  43. data/spec/lib/pact/consumer/mock_service/app_spec.rb +2 -2
  44. data/spec/lib/pact/consumer/mock_service/interaction_mismatch_spec.rb +2 -2
  45. data/spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb +12 -0
  46. data/spec/lib/pact/consumer/mock_service/verification_get_spec.rb +2 -2
  47. data/spec/lib/pact/consumer/mock_service_client_spec.rb +88 -0
  48. data/spec/lib/pact/consumer/mock_service_interaction_expectation_spec.rb +4 -4
  49. data/spec/lib/pact/consumer_contract/consumer_contract_spec.rb +18 -18
  50. data/spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb +111 -0
  51. data/spec/lib/pact/provider/configuration/pact_verification_spec.rb +1 -1
  52. data/spec/lib/pact/provider/pact_helper_locator_spec.rb +2 -2
  53. data/spec/lib/pact/provider/rspec/{formatter_spec.rb → formatter_rspec_2_spec.rb} +14 -4
  54. data/spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb +72 -0
  55. data/spec/lib/pact/provider/rspec_spec.rb +3 -0
  56. data/spec/lib/pact/provider/state/provider_state_manager_spec.rb +1 -1
  57. data/spec/lib/pact/provider/state/provider_state_proxy_spec.rb +4 -4
  58. data/spec/lib/pact/provider/state/provider_state_spec.rb +7 -7
  59. data/spec/lib/pact/provider/world_spec.rb +8 -8
  60. data/spec/lib/pact/tasks/verification_task_spec.rb +2 -2
  61. data/spec/spec_helper.rb +2 -4
  62. data/spec/support/factories.rb +13 -13
  63. data/spec/support/spec_support.rb +10 -0
  64. data/spec/support/stubbing_using_allow.rb +0 -4
  65. data/tasks/pact-test.rake +12 -8
  66. metadata +27 -24
  67. data/bethtest.rb +0 -30
  68. data/lib/pact/provider/rspec/silent_json_formatter.rb +0 -18
  69. data/spec/support/stubbing.rb +0 -26
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.2.1.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Fraser
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2014-06-02 00:00:00.000000000 Z
16
+ date: 2014-06-13 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: randexp
@@ -36,17 +36,17 @@ dependencies:
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  none: false
38
38
  requirements:
39
- - - ~>
39
+ - - ! '>='
40
40
  - !ruby/object:Gem::Version
41
- version: '2.12'
41
+ version: '2.14'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  none: false
46
46
  requirements:
47
- - - ~>
47
+ - - ! '>='
48
48
  - !ruby/object:Gem::Version
49
- version: '2.12'
49
+ version: '2.14'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: find_a_port
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +182,7 @@ dependencies:
182
182
  requirements:
183
183
  - - ~>
184
184
  - !ruby/object:Gem::Version
185
- version: 1.9.3
185
+ version: 1.18.0
186
186
  type: :development
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: 1.9.3
193
+ version: 1.18.0
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: pry
196
196
  requirement: !ruby/object:Gem::Requirement
@@ -240,7 +240,7 @@ dependencies:
240
240
  - !ruby/object:Gem::Version
241
241
  version: '2.0'
242
242
  - !ruby/object:Gem::Dependency
243
- name: rspec-fire
243
+ name: activesupport
244
244
  requirement: !ruby/object:Gem::Requirement
245
245
  none: false
246
246
  requirements:
@@ -256,7 +256,7 @@ dependencies:
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  - !ruby/object:Gem::Dependency
259
- name: activesupport
259
+ name: faraday
260
260
  requirement: !ruby/object:Gem::Requirement
261
261
  none: false
262
262
  requirements:
@@ -295,7 +295,6 @@ files:
295
295
  - LICENSE.txt
296
296
  - README.md
297
297
  - Rakefile
298
- - bethtest.rb
299
298
  - bin/pact
300
299
  - config.ru
301
300
  - documentation/README.md
@@ -358,6 +357,7 @@ files:
358
357
  - lib/pact/consumer/mock_service/log_get.rb
359
358
  - lib/pact/consumer/mock_service/missing_interactions_get.rb
360
359
  - lib/pact/consumer/mock_service/mock_service_administration_endpoint.rb
360
+ - lib/pact/consumer/mock_service/pact_post.rb
361
361
  - lib/pact/consumer/mock_service/rack_request_helper.rb
362
362
  - lib/pact/consumer/mock_service/verification_get.rb
363
363
  - lib/pact/consumer/mock_service_client.rb
@@ -366,8 +366,10 @@ files:
366
366
  - lib/pact/consumer/rspec.rb
367
367
  - lib/pact/consumer/server.rb
368
368
  - lib/pact/consumer/spec_hooks.rb
369
+ - lib/pact/consumer/world.rb
369
370
  - lib/pact/consumer_contract.rb
370
371
  - lib/pact/consumer_contract/consumer_contract.rb
372
+ - lib/pact/consumer_contract/consumer_contract_writer.rb
371
373
  - lib/pact/consumer_contract/file_name.rb
372
374
  - lib/pact/consumer_contract/interaction.rb
373
375
  - lib/pact/consumer_contract/pact_file.rb
@@ -419,9 +421,9 @@ files:
419
421
  - lib/pact/provider/request.rb
420
422
  - lib/pact/provider/rspec.rb
421
423
  - lib/pact/provider/rspec/custom_options_file
422
- - lib/pact/provider/rspec/formatter.rb
424
+ - lib/pact/provider/rspec/formatter_rspec_2.rb
425
+ - lib/pact/provider/rspec/formatter_rspec_3.rb
423
426
  - lib/pact/provider/rspec/matchers.rb
424
- - lib/pact/provider/rspec/silent_json_formatter.rb
425
427
  - lib/pact/provider/state/provider_state.rb
426
428
  - lib/pact/provider/state/provider_state_configured_modules.rb
427
429
  - lib/pact/provider/state/provider_state_manager.rb
@@ -467,11 +469,13 @@ files:
467
469
  - spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb
468
470
  - spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb
469
471
  - spec/lib/pact/consumer/mock_service/verification_get_spec.rb
472
+ - spec/lib/pact/consumer/mock_service_client_spec.rb
470
473
  - spec/lib/pact/consumer/mock_service_interaction_expectation_spec.rb
471
474
  - spec/lib/pact/consumer/request_spec.rb
472
475
  - spec/lib/pact/consumer/service_consumer_spec.rb
473
476
  - spec/lib/pact/consumer_contract/active_support_support_spec.rb
474
477
  - spec/lib/pact/consumer_contract/consumer_contract_spec.rb
478
+ - spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb
475
479
  - spec/lib/pact/consumer_contract/interaction_spec.rb
476
480
  - spec/lib/pact/consumer_contract/request_spec.rb
477
481
  - spec/lib/pact/doc/generator_spec.rb
@@ -498,7 +502,8 @@ files:
498
502
  - spec/lib/pact/provider/pact_helper_locator_spec.rb
499
503
  - spec/lib/pact/provider/print_missing_provider_states_spec.rb
500
504
  - spec/lib/pact/provider/request_spec.rb
501
- - spec/lib/pact/provider/rspec/formatter_spec.rb
505
+ - spec/lib/pact/provider/rspec/formatter_rspec_2_spec.rb
506
+ - spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb
502
507
  - spec/lib/pact/provider/rspec_spec.rb
503
508
  - spec/lib/pact/provider/state/provider_state_manager_spec.rb
504
509
  - spec/lib/pact/provider/state/provider_state_proxy_spec.rb
@@ -533,7 +538,6 @@ files:
533
538
  - spec/support/shared_examples_for_request.rb
534
539
  - spec/support/spec_support.rb
535
540
  - spec/support/stubbing.json
536
- - spec/support/stubbing.rb
537
541
  - spec/support/stubbing_using_allow.rb
538
542
  - spec/support/term.json
539
543
  - spec/support/test_app_fail.json
@@ -555,16 +559,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
555
559
  version: '0'
556
560
  segments:
557
561
  - 0
558
- hash: 3393348357730131022
562
+ hash: 984907966293091128
559
563
  required_rubygems_version: !ruby/object:Gem::Requirement
560
564
  none: false
561
565
  requirements:
562
- - - ! '>='
566
+ - - ! '>'
563
567
  - !ruby/object:Gem::Version
564
- version: '0'
565
- segments:
566
- - 0
567
- hash: 3393348357730131022
568
+ version: 1.3.1
568
569
  requirements: []
569
570
  rubyforge_project:
570
571
  rubygems_version: 1.8.23
@@ -593,11 +594,13 @@ test_files:
593
594
  - spec/lib/pact/consumer/mock_service/interaction_replay_spec.rb
594
595
  - spec/lib/pact/consumer/mock_service/rack_request_helper_spec.rb
595
596
  - spec/lib/pact/consumer/mock_service/verification_get_spec.rb
597
+ - spec/lib/pact/consumer/mock_service_client_spec.rb
596
598
  - spec/lib/pact/consumer/mock_service_interaction_expectation_spec.rb
597
599
  - spec/lib/pact/consumer/request_spec.rb
598
600
  - spec/lib/pact/consumer/service_consumer_spec.rb
599
601
  - spec/lib/pact/consumer_contract/active_support_support_spec.rb
600
602
  - spec/lib/pact/consumer_contract/consumer_contract_spec.rb
603
+ - spec/lib/pact/consumer_contract/consumer_contract_writer_spec.rb
601
604
  - spec/lib/pact/consumer_contract/interaction_spec.rb
602
605
  - spec/lib/pact/consumer_contract/request_spec.rb
603
606
  - spec/lib/pact/doc/generator_spec.rb
@@ -624,7 +627,8 @@ test_files:
624
627
  - spec/lib/pact/provider/pact_helper_locator_spec.rb
625
628
  - spec/lib/pact/provider/print_missing_provider_states_spec.rb
626
629
  - spec/lib/pact/provider/request_spec.rb
627
- - spec/lib/pact/provider/rspec/formatter_spec.rb
630
+ - spec/lib/pact/provider/rspec/formatter_rspec_2_spec.rb
631
+ - spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb
628
632
  - spec/lib/pact/provider/rspec_spec.rb
629
633
  - spec/lib/pact/provider/state/provider_state_manager_spec.rb
630
634
  - spec/lib/pact/provider/state/provider_state_proxy_spec.rb
@@ -659,7 +663,6 @@ test_files:
659
663
  - spec/support/shared_examples_for_request.rb
660
664
  - spec/support/spec_support.rb
661
665
  - spec/support/stubbing.json
662
- - spec/support/stubbing.rb
663
666
  - spec/support/stubbing_using_allow.rb
664
667
  - spec/support/term.json
665
668
  - spec/support/test_app_fail.json
data/bethtest.rb DELETED
@@ -1,30 +0,0 @@
1
- require 'colored'
2
-
3
- puts "Key: #{'-'.red} expected, #{'+'.green} actual"
4
-
5
- puts '{
6
- "_embedded": {'
7
- puts '- "events": [
8
- - {
9
- - "probability": "75",
10
- - "timestamp": "2014-03-03T14:00:00+00:00",
11
- - "_embedded": {
12
- - "opportunity": {
13
- - "displayAdvertising": true,
14
- - "_links": {
15
- - "self": {
16
- - "href": "http://media-opportunities/opportunity-id-1"
17
- - },
18
- - "mediaProject": {
19
- - "href": "http://media-projects/project-id-1"
20
- - }
21
- - }
22
- - }
23
- - }
24
- - }
25
- - ]'.red
26
- puts '+ {
27
- + }'.green
28
- puts ' }
29
- }'
30
-
@@ -1,18 +0,0 @@
1
- require 'rspec/core/formatters'
2
-
3
- module Pact
4
- module Provider
5
- module RSpec
6
- class SilentJsonFormatter < ::RSpec::Core::Formatters::JsonFormatter
7
-
8
- def initialize stream
9
- # Don't want to display this to the screen,
10
- # not sure how else to set a custom stream for a particular formatter
11
- # Store a reference to this so it can be inspected afterwards.
12
- super(Pact.world.json_formatter_stream)
13
- end
14
-
15
- end
16
- end
17
- end
18
- end
@@ -1,26 +0,0 @@
1
- require 'pact/provider/rspec'
2
- require 'rspec/mocks'
3
-
4
- class StubbedThing
5
- def self.stub_me
6
- end
7
- end
8
-
9
- class App
10
- def self.call env
11
- [200, {}, [StubbedThing.stub_me]]
12
- end
13
- end
14
-
15
- Pact.provider_states_for 'Consumer' do
16
-
17
- provider_state 'something is stubbed' do
18
- set_up do
19
- StubbedThing.stub(:stub_me).and_return("stubbing works")
20
- end
21
- end
22
- end
23
-
24
- Pact.service_provider 'Provider' do
25
- app { App }
26
- end