Skip to content

Commit d576b4c

Browse files
authored
Merge pull request #141 from YOU54F/ruby_3_1
Ruby 3 1
2 parents c51b79c + be1dfca commit d576b4c

22 files changed

+145
-103
lines changed

.github/workflows/release_gem.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: ruby/setup-ruby@v1
1515
with:
16-
ruby-version: '2.7'
16+
ruby-version: '3.1'
1717
- run: "bundle install"
18-
# - name: Test
19-
# run: bundle exec rake
18+
- name: Test
19+
run: bundle exec rake
2020

2121
release:
2222
needs: test

.github/workflows/test.yml.hangs renamed to .github/workflows/test.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: "ubuntu-latest"
8-
continue-on-error: ${{ matrix.experimental }}
97
strategy:
108
fail-fast: false
119
matrix:
12-
ruby_version: ["2.2", "2.7"]
13-
experimental: [false]
14-
include:
15-
- ruby_version: "3.0"
16-
experimental: true
10+
ruby_version: ["2.7","3.0","3.1"]
11+
os: ["ubuntu-latest","windows-latest","macos-latest"]
12+
runs-on: ${{ matrix.os }}
1713
steps:
1814
- uses: actions/checkout@v2
1915
- uses: ruby/setup-ruby@v1

lib/pact/mock_service/interactions/interaction_mismatch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def to_hash
5656
def to_s
5757
[
5858
"Diff with interaction: #{candidate_interaction.description_with_provider_state_quoted}",
59-
diff_formatter.call(diff, {colour: false})
59+
diff_formatter.call(diff, **{colour: false})
6060
].join("\n")
6161
end
6262

pact-mock_service.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ Gem::Specification.new do |gem|
2626
gem.add_runtime_dependency 'thor', '>= 0.19', '< 2.0'
2727
gem.add_runtime_dependency 'json'
2828
gem.add_runtime_dependency 'webrick', '~> 1.3'
29-
gem.add_runtime_dependency 'term-ansicolor', '~> 1.0'
3029
gem.add_runtime_dependency 'pact-support', '~> 1.16', '>= 1.16.4'
3130
gem.add_runtime_dependency 'filelock', '~> 1.1'
3231

3332
gem.add_development_dependency 'rack-test', '~> 0.7'
3433
gem.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
3534
gem.add_development_dependency 'webmock', '~> 3.4'
3635
gem.add_development_dependency 'pry'
37-
gem.add_development_dependency 'fakefs', '~> 0.4'
36+
gem.add_development_dependency 'fakefs', '~> 2.4'
3837
gem.add_development_dependency 'hashie', '~> 2.0'
3938
gem.add_development_dependency 'activesupport', '~> 5.1'
4039
gem.add_development_dependency 'faraday', '~> 0.12'

spec/features/administration_endpoints_cors_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@
108108

109109
context "when the Origin header is set" do
110110
it "sets the Access-Control-Allow-Origin header to be the Origin" do
111-
options '/pact', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'X-Pact-Mock-Service, Content-Type', 'HTTP_ORIGIN' => 'http://localhost:1234' }
112-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
111+
options '/pact', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'X-Pact-Mock-Service, Content-Type', 'HTTP_ORIGIN' => 'http://localhost:8888' }
112+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
113113
end
114114
end
115115
end

spec/features/log/mock_multiple_responses_spec.log

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ Missing requests:
209209
GET /alligators
210210

211211

212+
212213
WARN -- : Missing requests:
213214
GET /alligators
214215
GET /alligators
215216

216217

218+

spec/features/log/mock_one_response_spec.log

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,44 @@ WARN -- : Verifying - actual interactions do not match expected interactions for
111111
Incorrect requests:
112112
GET /alligators (request headers did not match)
113113

114+
Diff with interaction: "a request for alligators" given "alligators exist"
115+
Diff
116+
--------------------------------------
117+
Key: - is expected
118+
+ is actual
119+
Matching keys and values are not shown
120+
121+
{
122+
"headers": {
123+
- "Accept": "application/json"
124+
+ "Accept": "application/xml"
125+
}
126+
}
127+
128+
Description of differences
129+
--------------------------------------
130+
* Expected "application/json" but got "application/xml" at $.headers.Accept
131+
114132

115133
WARN -- : Incorrect requests:
116134
GET /alligators (request headers did not match)
117135

136+
Diff with interaction: "a request for alligators" given "alligators exist"
137+
Diff
138+
--------------------------------------
139+
Key: - is expected
140+
+ is actual
141+
Matching keys and values are not shown
142+
143+
{
144+
"headers": {
145+
- "Accept": "application/json"
146+
+ "Accept": "application/xml"
147+
}
148+
}
149+
150+
Description of differences
151+
--------------------------------------
152+
* Expected "application/json" but got "application/xml" at $.headers.Accept
153+
118154

spec/features/mock_interactions_with_cors_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@
5656
expect(last_response.status).to be 200
5757

5858
# OPTIONS request from the browser for the request under test
59-
options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:1234' }
59+
options '/alligators/new', nil, { 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'accept', 'HTTP_ORIGIN' => 'http://localhost:8888' }
6060

6161
# Ensure it allows the browser to actually make the request
6262
expect(last_response.status).to eq 200
63-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
63+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
6464
expect(last_response.headers['Access-Control-Allow-Credentials']).to eq 'true'
6565
expect(last_response.headers['Access-Control-Allow-Headers']).to include 'accept'
6666
expect(last_response.headers['Access-Control-Allow-Methods']).to include "DELETE, POST, GET, HEAD, PUT, TRACE, CONNECT"
6767

6868
# Make the request
69-
post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:1234' }
69+
post "/alligators/new", actual_request, { 'HTTP_ACCEPT' => 'application/json', 'HTTP_ORIGIN' => 'http://localhost:8888' }
7070

7171
# Ensure that the response we get back was the one we expected
7272
# and includes the CORS header
73-
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:1234'
73+
expect(last_response.headers['Access-Control-Allow-Origin']).to eq 'http://localhost:8888'
7474
expect(last_response.headers['Content-Type']).to eq 'application/json'
7575
expect(JSON.parse(last_response.body)).to eq([{ 'name' => 'Mary' }])
7676
end

spec/integration/cli_cors_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
require 'fileutils'
33
require 'support/integration_spec_support'
44

5-
describe "The pact-mock-service command line interface", mri_only: true do
5+
describe "The pact-mock-service command line interface", mri_only: true, skip_windows: true do
66

77
include Pact::IntegrationTestSupport
88

99
before :all do
1010
clear_dirs
11-
@pid = start_server 1234, '--cors'
11+
@pid = start_server 8888, '--cors'
1212
end
1313

1414
it "responds to an OPTIONS request for a non administration request" do
15-
response = make_options_request 1234
15+
response = make_options_request 8888
1616
expect(response.status).to eq 200
1717
expect(response.headers['Access-Control-Allow-Headers']).to_not be nil
1818
end

spec/integration/cli_monkeypatch_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'support/integration_spec_support'
33
require 'find_a_port'
44

5-
describe "The pact-mock-service command line interface with a monkeypatch", mri_only: true do
5+
describe "The pact-mock-service command line interface with a monkeypatch", mri_only: true, skip_windows: true do
66

77
include Pact::IntegrationTestSupport
88

0 commit comments

Comments
 (0)