pact 1.14.0 → 1.15.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: 1fb2ea12b63cd90b9451173dd6deb6a10146d426
4
- data.tar.gz: 2ba870980eb5403ab32c405138315b6f471b189e
3
+ metadata.gz: 903434f95e7bb3d1f41d10777304a704a81e5cb0
4
+ data.tar.gz: d9fd3b985b19bb87176d56f923a3a03931e1478e
5
5
  SHA512:
6
- metadata.gz: 517699fa66be479723e0f703dc00e5453482d18d5463b59176b8fd09138211c648dfa8f654223690f77c1cbe4cafad7ae98165c97b3561e69248a7bb4ad204f4
7
- data.tar.gz: 44ef94d0fa65a5ee0b003ec3e7f8c6915da6c8ecadce6c690fa9c5a50e507f313f39b802839e3671cbfb5aea54ea9c4735d86a5ee1f854f37533333d37851985
6
+ metadata.gz: '06297661ac29c200952122436da6cce77b2b70e066248ab0c0e6778c9cfaf7791dc72368584b602364a6c8f84b536d0d0f382d0b73a4f6977af305fc05616bb0'
7
+ data.tar.gz: 8a092d7ea089d1808ea1959389df055c8187e600f73ac56e10977feaf6e857b8afa60295a3fcbe1a3fcf4f962c37b99c52bf663f3a09270085f523b4d6c90ad0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@ Do this to generate your change history
2
2
 
3
3
  git log --pretty=format:' * %h - %s (%an, %ad)'
4
4
 
5
+ ## 1.15.0 (11 August 2017)
6
+ * a950a16 - fix: Fix module declaration (Beth Skurrie, Fri Aug 11 11:47:46 2017 +1000)
7
+ * 14cd969 - feat(output): Remove ruby specific text from pact verification output. (Beth Skurrie, Tue Aug 8 17:12:50 2017 +1000)
8
+
5
9
  ## 1.14.0 (19 June 2017)
6
10
  * eb44499 - Updated pact-support version (Beth Skurrie, Mon Jun 19 09:51:13 2017 +1000)
7
11
  * 8835496 - Changed colour of acutal response body output (Beth Skurrie, Tue Jun 6 10:44:45 2017 +1000)
@@ -29,7 +29,9 @@ module Pact
29
29
  end
30
30
 
31
31
  def print_missing_provider_states
32
- PrintMissingProviderStates.call Pact.provider_world.provider_states.missing_provider_states, output
32
+ if executing_with_ruby?
33
+ PrintMissingProviderStates.call Pact.provider_world.provider_states.missing_provider_states, output
34
+ end
33
35
  end
34
36
 
35
37
  def interaction_rerun_commands
@@ -39,26 +41,33 @@ module Pact
39
41
  end
40
42
 
41
43
  def interaction_rerun_command_for example
42
- provider_state = example.metadata[:pact_interaction].provider_state
43
- description = example.metadata[:pact_interaction].description
44
- pactfile_uri = example.metadata[:pactfile_uri]
45
44
  example_description = example.metadata[:pact_interaction_example_description]
46
- failure_color("bundle exec rake pact:verify:at[#{pactfile_uri}] PACT_DESCRIPTION=\"#{description}\" PACT_PROVIDER_STATE=\"#{provider_state}\"") + " " + detail_color("# #{example_description}")
45
+ if ENV['PACT_INTERACTION_RERUN_COMMAND']
46
+ cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
47
+ provider_state = example.metadata[:pact_interaction].provider_state
48
+ description = example.metadata[:pact_interaction].description
49
+ pactfile_uri = example.metadata[:pactfile_uri]
50
+ cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
51
+ cmd.gsub!("<PACT_DESCRIPTION>", description)
52
+ cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
53
+ failure_color(cmd) + " " + detail_color("# #{example_description}")
54
+ else
55
+ failure_color("* #{example_description}")
56
+ end
47
57
  end
48
58
 
49
59
  def print_failure_message
50
- output.puts failure_message
60
+ output.puts(failure_message) if executing_with_ruby?
51
61
  end
52
62
 
53
63
  def failure_message
54
64
  "\n" + Pact::Provider::Help::PromptText.() + "\n"
55
65
  end
56
66
 
67
+ def executing_with_ruby?
68
+ ENV['PACT_EXECUTING_LANGUAGE'] == 'ruby'
69
+ end
57
70
  end
58
-
59
71
  end
60
-
61
72
  end
62
73
  end
63
-
64
-
@@ -55,26 +55,35 @@ module Pact
55
55
  end
56
56
 
57
57
  def print_missing_provider_states
58
- PrintMissingProviderStates.call Pact.provider_world.provider_states.missing_provider_states, output
58
+ if executing_with_ruby?
59
+ PrintMissingProviderStates.call Pact.provider_world.provider_states.missing_provider_states, output
60
+ end
59
61
  end
60
62
 
61
63
  def interaction_rerun_commands summary
62
64
  summary.failed_examples.collect do |example|
63
65
  interaction_rerun_command_for example
64
- end.uniq
66
+ end.uniq.compact
65
67
  end
66
68
 
67
69
  def interaction_rerun_command_for example
68
- provider_state = example.metadata[:pact_interaction].provider_state
69
- description = example.metadata[:pact_interaction].description
70
- pactfile_uri = example.metadata[:pactfile_uri]
71
70
  example_description = example.metadata[:pact_interaction_example_description]
72
- colorizer.wrap("bundle exec rake pact:verify:at[#{pactfile_uri}] PACT_DESCRIPTION=\"#{description}\" PACT_PROVIDER_STATE=\"#{provider_state}\" ", ::RSpec.configuration.failure_color) +
73
- colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
71
+ if ENV['PACT_INTERACTION_RERUN_COMMAND']
72
+ cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
73
+ provider_state = example.metadata[:pact_interaction].provider_state
74
+ description = example.metadata[:pact_interaction].description
75
+ pactfile_uri = example.metadata[:pactfile_uri]
76
+ cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
77
+ cmd.gsub!("<PACT_DESCRIPTION>", description)
78
+ cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
79
+ colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
80
+ else
81
+ colorizer.wrap("* #{example_description}", ::RSpec.configuration.failure_color)
82
+ end
74
83
  end
75
84
 
76
85
  def print_failure_message
77
- output.puts failure_message
86
+ output.puts(failure_message) if executing_with_ruby?
78
87
  end
79
88
 
80
89
  def failure_message
@@ -85,11 +94,11 @@ module Pact
85
94
  @colorizer ||= ::RSpec::Core::Formatters::ConsoleCodes
86
95
  end
87
96
 
97
+ def executing_with_ruby?
98
+ ENV['PACT_EXECUTING_LANGUAGE'] == 'ruby'
99
+ end
88
100
  end
89
-
90
101
  end
91
-
92
102
  end
93
103
  end
94
104
 
95
-
@@ -1,13 +1,15 @@
1
1
  require 'rspec/mocks'
2
2
 
3
3
  module Pact
4
- module Provider::State
5
- module ProviderStateConfiguredModules
4
+ module Provider
5
+ module State
6
+ module ProviderStateConfiguredModules
6
7
 
7
- include ::RSpec::Mocks::ExampleMethods
8
+ include ::RSpec::Mocks::ExampleMethods
8
9
 
9
- # Placeholder for modules configured using config.include
10
+ # Placeholder for modules configured using config.include
10
11
 
12
+ end
11
13
  end
12
14
  end
13
15
  end
@@ -5,6 +5,8 @@ require 'shellwords'
5
5
  module Pact
6
6
  module TaskHelper
7
7
 
8
+ PACT_INTERACTION_RERUN_COMMAND = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_DESCRIPTION=\"<PACT_DESCRIPTION>\" PACT_PROVIDER_STATE=\"<PACT_PROVIDER_STATE>\""
9
+
8
10
  extend self
9
11
 
10
12
  def execute_pact_verify pact_uri = nil, pact_helper = nil, rspec_opts = nil
@@ -35,8 +37,19 @@ module Pact
35
37
 
36
38
  def execute_cmd command
37
39
  $stdout.puts command
38
- system(command) ? 0 : 1
40
+ temporarily_set_env_var 'PACT_EXECUTING_LANGUAGE', 'ruby' do
41
+ temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND', PACT_INTERACTION_RERUN_COMMAND do
42
+ exit_status = system(command) ? 0 : 1
43
+ end
44
+ end
39
45
  end
40
46
 
47
+ def temporarily_set_env_var name, value
48
+ original_value = ENV[name]
49
+ ENV[name] ||= value
50
+ yield
51
+ ensure
52
+ ENV[name] = original_value
53
+ end
41
54
  end
42
55
  end
@@ -19,4 +19,4 @@
19
19
 
20
20
  * Check out https://github.com/realestate-com-au/pact/wiki/Troubleshooting
21
21
 
22
- * Ask a question in the google users' group https://groups.google.com/forum/#!forum/pact-support
22
+ * Ask a question on stackoverflow and tag it `pact-ruby`
data/lib/pact/version.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # Remember to bump pact-provider-proxy when this changes major version
1
2
  module Pact
2
- VERSION = "1.14.0"
3
+ VERSION = "1.15.0"
3
4
  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.14.0
4
+ version: 1.15.0
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: 2017-06-18 00:00:00.000000000 Z
15
+ date: 2017-08-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp
@@ -367,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
367
  version: '0'
368
368
  requirements: []
369
369
  rubyforge_project:
370
- rubygems_version: 2.4.5
370
+ rubygems_version: 2.6.11
371
371
  signing_key:
372
372
  specification_version: 4
373
373
  summary: Enables consumer driven contract testing, providing a mock service and DSL