Skip to content

Commit

Permalink
Merge pull request #292 from pact-foundation/ruby_3_2
Browse files Browse the repository at this point in the history
Ruby 3 2
  • Loading branch information
YOU54F authored May 17, 2023
2 parents 8f62f4f + d8d65b6 commit 6f9e6df
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release_gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
ruby-version: '3.2'
- run: |
gem install bundler -v 2.1
gem install bundler -v 2.4
bundle install
- name: Test
run: bundle exec rake
Expand All @@ -28,7 +28,7 @@ jobs:
version: ${{ steps.release-gem.outputs.version }}
increment: ${{ steps.release-gem.outputs.increment }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: release-gem
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,36 @@ on: [push, pull_request]

jobs:
test:
runs-on: "ubuntu-latest"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ruby_version: ["2.4", "2.7", "3.0"]
ruby_version: ["2.7", "3.0", "3.1", "3.2"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
# defaults:
# run:
# shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- run: "bundle exec rake"
test-with-active-support:
runs-on: "ubuntu-latest"
runs-on: ${{ matrix.os }}
env:
BUNDLE_GEMFILE: active-support.gemfile
strategy:
fail-fast: false
matrix:
ruby_version: ["2.7", "3.0"]
ruby_version: ["2.7", "3.0", "3.1", "3.2"]
os: ["ubuntu-latest","windows-latest","macos-latest"]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
Expand Down
2 changes: 1 addition & 1 deletion example/zoo-app/spec/service_providers/pact_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Pact.service_consumer 'Zoo App' do
has_pact_with "Animal Service" do
mock_service :animal_service do
port 1234
port 8888
pact_specification_version "2.0.0"
end
end
Expand Down
2 changes: 1 addition & 1 deletion pact.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Gem::Specification.new do |gem|

gem.add_development_dependency 'rake', '~> 13.0'
gem.add_development_dependency 'webmock', '~> 3.0'
gem.add_development_dependency 'fakefs', '0.5' # 0.6.0 blows up
gem.add_development_dependency 'fakefs', '2.4' # 0.6.0 blows up
gem.add_development_dependency 'hashie', '~> 2.0'
gem.add_development_dependency 'faraday', '~>1.0', '<3.0'
gem.add_development_dependency 'faraday-multipart', '~> 1.0'
Expand Down
4 changes: 2 additions & 2 deletions spec/features/consumption_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
has_pact_with "Alice Service" do
mock_service :alice_service do
verify true
port 1234
port 8888
end
end

Expand Down Expand Up @@ -76,7 +76,7 @@
})


alice_response = Net::HTTP.get_response(URI('http://localhost:1234/mallory'))
alice_response = Net::HTTP.get_response(URI('http://localhost:8888/mallory'))

expect(alice_response.code).to eql '200'
expect(alice_response['Content-Type']).to eql 'text/html'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/cli_docs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'support/cli'
require 'fileutils'

describe "running the pact docs CLI" do
describe "running the pact docs CLI", skip_windows: true do

include Pact::Support::CLI

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'open3'
require 'support/cli'

describe "running the pact verify CLI" do
describe "running the pact verify CLI", skip_windows: true do

include Pact::Support::CLI

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe "executing pact verify" do
RSpec.describe "executing pact verify", skip_windows: true do
let(:command) { "bundle exec rake pact:verify:test_app:fail > /dev/null" }
let(:reports_dir) { 'tmp/spec_reports' } # The config for this is in spec/support/pact_helper.rb

Expand Down
4 changes: 2 additions & 2 deletions spec/integration/pact/consumer_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestHelper

has_pact_with "My Service" do
mock_service :my_service do
port 1234
port 8888
standalone true
end
end
Expand All @@ -52,7 +52,7 @@ class TestHelper

context "when standalone is true" do
it "is not registerd with the AppManager" do
expect(Pact::MockService::AppManager.instance.app_registered_on?(1234)).to eq false
expect(Pact::MockService::AppManager.instance.app_registered_on?(8888)).to eq false
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact/consumer/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Pact::Consumer::Configuration
describe MockService do

let(:world) { Pact::Consumer::World.new }
let(:port_number) { 1234 }
let(:port_number) { 8888 }
before do
Pact.clear_configuration
allow(Pact::MockService::AppManager.instance).to receive(:register_mock_service_for).and_return(port_number)
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pact/consumer/consumer_contract_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ module Consumer
consumer_name: consumer_name,
provider_name: provider_name,
host: 'localhost',
port: 1234
port: 8888
)
end

it "returns the mock service base URL" do
expect(subject.mock_service_base_url).to eq("http://localhost:1234")
expect(subject.mock_service_base_url).to eq("http://localhost:8888")
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/lib/pact/provider/rspec/formatter_rspec_3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module RSpec
let(:examples) { [example, example, example_2]}
let(:output) { StringIO.new }
let(:rerun_command) { 'PACT_DESCRIPTION="a description" PACT_PROVIDER_STATE="a state" # an interaction' }
let(:broker_rerun_command) { "rake pact:verify:at[pact_file_uri] PACT_BROKER_INTERACTION_ID=\"1234\" # an interaction" }
let(:broker_rerun_command) { "rake pact:verify:at[pact_file_uri] PACT_BROKER_INTERACTION_ID=\"8888\" # an interaction" }
let(:missing_provider_states) { 'missing_provider_states'}
let(:summary) { double("summary", failure_count: 1, failed_examples: failed_examples, examples: examples)}
let(:pact_executing_language) { 'ruby' }
Expand Down Expand Up @@ -77,7 +77,7 @@ module RSpec

context "when PACT_INTERACTION_RERUN_COMMAND_FOR_BROKER is set" do
context "when the _id is populated" do
let(:id) { "1234" }
let(:id) { "8888" }

it "prints a list of rerun commands" do
expect(output_result).to include(broker_rerun_command)
Expand All @@ -100,10 +100,10 @@ module RSpec
let(:pact_interaction_rerun_command_for_broker) { nil }

context "when the _id is populated" do
let(:id) { "1234" }
let(:id) { "8888" }

it "prints a list of failed interactions" do
expect(output_result).to include('* an interaction (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID="1234")')
expect(output_result).to include('* an interaction (to re-run just this interaction, set environment variable PACT_BROKER_INTERACTION_ID="8888")')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/service_providers/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Pact.service_consumer 'Pact Ruby' do
has_pact_with 'Pact Broker' do
mock_service :pact_broker do
port 1234
port 8888
pact_specification_version '2.0.0'
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
require './spec/support/warning_silencer'

is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
is_windows = Gem.win_platform?

RSpec.configure do | config |
config.include(FakeFS::SpecHelpers, fakefs: true)
Expand All @@ -25,4 +26,5 @@
config.example_status_persistence_file_path = "./spec/examples.txt"
end
config.filter_run_excluding skip_jruby: is_jruby
config.filter_run_excluding skip_windows: is_windows
end
2 changes: 2 additions & 0 deletions tasks/pact-test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ namespace :pact do

desc "All the verification tests"
task "tests:all" do
next if Gem.win_platform?

Rake::Task['pact:verify:stubbing'].execute
Rake::Task['spec:standalone:pass'].execute
Rake::Task['pact:verify'].execute
Expand Down

0 comments on commit 6f9e6df

Please sign in to comment.