Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
rack_version: ["2", "3"]
runs-on: ${{ matrix.os }}
env:
RACK_VERSION: ${{ matrix.rack_version }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
- run: "bundle install"
- run: "bundle exec rake"
- run: "bundle exec rake"
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ if ENV['X_PACT_DEVELOPMENT']
gem "pact-message", path: '../pact-message-ruby'
gem "pact-support", path: '../pact-support'
end

gem 'rack-reverse-proxy', git: 'https://github.com/pact-foundation/rack-reverse-proxy.git',
branch: 'feat/rack_2_and_3_compat'
8 changes: 7 additions & 1 deletion pact-provider-verifier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'faraday', '~> 2.5'
gem.add_runtime_dependency 'faraday-retry', '~> 2.2'
gem.add_runtime_dependency 'json', '>1.8'
gem.add_runtime_dependency 'rack', '~> 2.1'
if ENV['RACK_VERSION'] == '2'
gem.add_runtime_dependency 'rack', '>= 2.0', '< 3.0'
else
gem.add_runtime_dependency 'rack', '>= 3.0', '< 4.0'
gem.add_runtime_dependency 'rackup', '~> 2.0'
end

gem.add_runtime_dependency 'rack-reverse-proxy'
gem.add_runtime_dependency 'rspec_junit_formatter', '~> 0.3'
gem.add_runtime_dependency 'ostruct'
Expand Down
1 change: 1 addition & 0 deletions spec/integration_with_pact_broker_config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'pact/provider_verifier/cli/verify'
require 'pact/pact_broker'
require 'pact/cli/run_pact_verification'
require 'ostruct'

describe "pact-provider-verifier with pact broker config" do
before do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'pact/provider_verifier/aggregate_pact_configs'
require 'ostruct'

module Pact
module ProviderVerifier
Expand Down
3 changes: 2 additions & 1 deletion spec/support/message_producer_verifier.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# TODO provider states

require 'json'
require 'ostruct'

class Provider
def a_test_message
Expand Down Expand Up @@ -31,7 +32,7 @@ class HttpRequestHandler
request_body = JSON.parse(env['rack.input'].read)
message_descriptor = OpenStruct.new(request_body)
response_body = @message_creator.create(message_descriptor)
[200, {'Content-Type' => 'application/json'}, [response_body.to_json]]
[200, {'content-type' => 'application/json'}, [response_body.to_json]]
end

end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/provider-echo-host.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require 'json'

run -> (env) {
body = {"Host" => env['HTTP_HOST']}.to_json
[200, {"Content-Type" => "application/json"}, [body]]
[200, {"content-type" => "application/json"}, [body]]
}
2 changes: 1 addition & 1 deletion spec/support/provider_with_self_signed_cert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
def run_provider_with_self_signed_cert port
# trap 'INT' do @server.shutdown end
require 'rack'
require 'rack/handler/webrick'
require_relative 'webbrick'
require 'webrick/https'

webrick_opts = {:Port => port, :SSLEnable => true, :SSLCertName => [%w[CN localhost]]}
Expand Down
11 changes: 11 additions & 0 deletions spec/support/webbrick.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Rack
module Handler
begin
require 'rack/handler/webrick'
WEBrick = Class.new(Rack::Handler::WEBrick)
rescue LoadError
require 'rackup/handler/webrick'
WEBrick = Class.new(Rackup::Handler::WEBrick)
end
end
end