pact 1.50.1 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/pact/cli.rb +2 -0
- data/lib/pact/cli/spec_criteria.rb +3 -0
- data/lib/pact/provider/rspec/formatter_rspec_3.rb +20 -5
- data/lib/pact/tasks/task_helper.rb +6 -1
- data/lib/pact/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d44ad8e4df2bd24bef464ef32020657e3e0262627c68e351c3678f249f490416
         | 
| 4 | 
            +
              data.tar.gz: 4e81574cbea58077da6f937030078126403854f09caf778c13ef92860c3de731
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz: ' | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: '0928d99da9e29d1574b8e788c8125f58eabcf866b373e40a9a13b4aa8ea90f7b138fa38cff40050738f54500cd5be5fb98a42e0941b838c23b7aa2e3b4bbafef'
         | 
| 7 | 
            +
              data.tar.gz: baf430cc555d61d1ed2d0c375c8038d70894b0ff27fa5eb2e82e4c5db1d347c219f354b6793319a8168bd8c028530dc3378b469c7f2f1859026d9e5c3671d028
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/pact/cli.rb
    CHANGED
    
    | @@ -18,6 +18,8 @@ module Pact | |
| 18 18 | 
             
                              default: Pact.configuration.interactions_replay_order
         | 
| 19 19 | 
             
                method_option :description, aliases: "-d", desc: "Interaction description filter"
         | 
| 20 20 | 
             
                method_option :provider_state, aliases: "-s", desc: "Provider state filter"
         | 
| 21 | 
            +
                method_option :interaction_index, type: :numeric, desc: "Index filter"
         | 
| 22 | 
            +
                method_option :pact_broker_interaction_id, desc: "Pact Broker interaction ID filter"
         | 
| 21 23 | 
             
                method_option :format, aliases: "-f", banner: "FORMATTER", desc: "RSpec formatter. Defaults to custom Pact formatter. [j]son may also be used."
         | 
| 22 24 | 
             
                method_option :out, aliases: "-o", banner: "FILE", desc: "Write output to a file instead of $stdout."
         | 
| 23 25 |  | 
| @@ -6,8 +6,11 @@ module Pact | |
| 6 6 | 
             
                    criteria = {}
         | 
| 7 7 |  | 
| 8 8 | 
             
                    criteria[:description] = Regexp.new(options[:description]) if options[:description]
         | 
| 9 | 
            +
                    criteria[:_id] = options[:pact_broker_interaction_id] if options[:pact_broker_interaction_id]
         | 
| 10 | 
            +
                    criteria[:index] = options[:interaction_index] if options[:interaction_index]
         | 
| 9 11 |  | 
| 10 12 | 
             
                    provider_state = options[:provider_state]
         | 
| 13 | 
            +
             | 
| 11 14 | 
             
                    if provider_state
         | 
| 12 15 | 
             
                      if provider_state.length == 0
         | 
| 13 16 | 
             
                        criteria[:provider_state] = nil #Allow PACT_PROVIDER_STATE="" to mean no provider state
         | 
| @@ -93,17 +93,32 @@ module Pact | |
| 93 93 |  | 
| 94 94 | 
             
                    def interaction_rerun_command_for example
         | 
| 95 95 | 
             
                      example_description = example.metadata[:pact_interaction_example_description]
         | 
| 96 | 
            -
             | 
| 96 | 
            +
             | 
| 97 | 
            +
                      _id = example.metadata[:pact_interaction]._id
         | 
| 98 | 
            +
                      index = example.metadata[:pact_interaction].index
         | 
| 99 | 
            +
                      provider_state = example.metadata[:pact_interaction].provider_state
         | 
| 100 | 
            +
                      description = example.metadata[:pact_interaction].description
         | 
| 101 | 
            +
                      pactfile_uri = example.metadata[:pactfile_uri]
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                      if _id && ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER']
         | 
| 104 | 
            +
                        cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER'])
         | 
| 105 | 
            +
                        cmd.gsub!("<PACT_URI>", example.metadata[:pactfile_uri].to_s)
         | 
| 106 | 
            +
                        cmd.gsub!("<PACT_BROKER_INTERACTION_ID>", "#{_id}")
         | 
| 107 | 
            +
                        colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
         | 
| 108 | 
            +
                      elsif ENV['PACT_INTERACTION_RERUN_COMMAND']
         | 
| 97 109 | 
             
                        cmd = String.new(ENV['PACT_INTERACTION_RERUN_COMMAND'])
         | 
| 98 | 
            -
                        provider_state = example.metadata[:pact_interaction].provider_state
         | 
| 99 | 
            -
                        description = example.metadata[:pact_interaction].description
         | 
| 100 | 
            -
                        pactfile_uri = example.metadata[:pactfile_uri]
         | 
| 101 110 | 
             
                        cmd.gsub!("<PACT_URI>", pactfile_uri.to_s)
         | 
| 102 111 | 
             
                        cmd.gsub!("<PACT_DESCRIPTION>", description)
         | 
| 103 112 | 
             
                        cmd.gsub!("<PACT_PROVIDER_STATE>", "#{provider_state}")
         | 
| 113 | 
            +
                        cmd.gsub!("<PACT_INTERACTION_INDEX>", "#{index}")
         | 
| 104 114 | 
             
                        colorizer.wrap("#{cmd} ", ::RSpec.configuration.failure_color) + colorizer.wrap("# #{example_description}", ::RSpec.configuration.detail_color)
         | 
| 105 115 | 
             
                      else
         | 
| 106 | 
            -
                         | 
| 116 | 
            +
                        message = if _id
         | 
| 117 | 
            +
                          "* #{example_description} (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID=\"#{_id}\")"
         | 
| 118 | 
            +
                        else
         | 
| 119 | 
            +
                          "* #{example_description} (to re-run just this interaction, set environment variables PACT_DESCRIPTION=\"#{description}\" PACT_PROVIDER_STATE=\"#{provider_state}\")"
         | 
| 120 | 
            +
                        end
         | 
| 121 | 
            +
                        colorizer.wrap(message, ::RSpec.configuration.failure_color)
         | 
| 107 122 | 
             
                      end
         | 
| 108 123 | 
             
                    end
         | 
| 109 124 |  | 
| @@ -7,6 +7,7 @@ module Pact | |
| 7 7 | 
             
              module TaskHelper
         | 
| 8 8 |  | 
| 9 9 | 
             
                PACT_INTERACTION_RERUN_COMMAND = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_DESCRIPTION=\"<PACT_DESCRIPTION>\" PACT_PROVIDER_STATE=\"<PACT_PROVIDER_STATE>\""
         | 
| 10 | 
            +
                PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER = "bundle exec rake pact:verify:at[<PACT_URI>] PACT_BROKER_INTERACTION_ID=\"<PACT_BROKER_INTERACTION_ID>\""
         | 
| 10 11 |  | 
| 11 12 | 
             
                extend self
         | 
| 12 13 |  | 
| @@ -34,6 +35,8 @@ module Pact | |
| 34 35 | 
             
                  command_parts << "--backtrace" if ENV['BACKTRACE'] == 'true'
         | 
| 35 36 | 
             
                  command_parts << "--description #{Shellwords.escape(ENV['PACT_DESCRIPTION'])}" if ENV['PACT_DESCRIPTION']
         | 
| 36 37 | 
             
                  command_parts << "--provider-state #{Shellwords.escape(ENV['PACT_PROVIDER_STATE'])}" if ENV['PACT_PROVIDER_STATE']
         | 
| 38 | 
            +
                  command_parts << "--pact-broker-interaction-id #{Shellwords.escape(ENV['PACT_BROKER_INTERACTION_ID'])}" if ENV['PACT_BROKER_INTERACTION_ID']
         | 
| 39 | 
            +
                  command_parts << "--interaction-index #{Shellwords.escape(ENV['PACT_INTERACTION_INDEX'])}" if ENV['PACT_INTERACTION_INDEX']
         | 
| 37 40 | 
             
                  command_parts.flatten.join(" ")
         | 
| 38 41 | 
             
                end
         | 
| 39 42 |  | 
| @@ -41,7 +44,9 @@ module Pact | |
| 41 44 | 
             
                  Pact.configuration.output_stream.puts command
         | 
| 42 45 | 
             
                  temporarily_set_env_var 'PACT_EXECUTING_LANGUAGE', 'ruby' do
         | 
| 43 46 | 
             
                    temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND', PACT_INTERACTION_RERUN_COMMAND do
         | 
| 44 | 
            -
                       | 
| 47 | 
            +
                      temporarily_set_env_var 'PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER', PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER do
         | 
| 48 | 
            +
                        exit_status = system(command) ? 0 : 1
         | 
| 49 | 
            +
                      end
         | 
| 45 50 | 
             
                    end
         | 
| 46 51 | 
             
                  end
         | 
| 47 52 | 
             
                end
         | 
    
        data/lib/pact/version.rb
    CHANGED
    
    
    
        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. | 
| 4 | 
            +
              version: 1.51.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: 2020-06- | 
| 15 | 
            +
            date: 2020-06-24 00:00:00.000000000 Z
         | 
| 16 16 | 
             
            dependencies:
         | 
| 17 17 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 18 18 | 
             
              name: rspec
         |