Skip to content

Commit

Permalink
Merge pull request #254 from interagent/feature/ruby_version
Browse files Browse the repository at this point in the history
add ruby 2.7.1 in .travis.yaml
  • Loading branch information
ota42y authored May 9, 2020
2 parents 942c88b + 7016ba0 commit c7fa422
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: ruby
rvm:
- 2.4.6
- 2.5.5
- 2.6.3
- 2.4.10
- 2.5.8
- 2.6.6
- 2.7.1
- ruby-head

before_install:
Expand Down
11 changes: 9 additions & 2 deletions test/middleware/request_validation_open_api_3_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,11 @@ def app
{ check_header: false, description: 'valid value', value: 1, expected: { status: 200 } },
{ check_header: false, description: 'missing value', value: nil, expected: { status: 200 } },
{ check_header: false, description: 'invalid value', value: 'x', expected: { status: 200 } },
].each do |check_header:, description:, value:, expected:|
].each do |h|
check_header = h[:check_header]
description = h[:description]
value = h[:value]
expected = h[:expected]
describe "when #{check_header}" do
%w(get post put patch delete).each do |method|
describe method do
Expand All @@ -439,7 +443,10 @@ def app
{ description: 'when not specified, includes everything', accept_request_filter: nil, expected: { status: 400 } },
{ description: 'when predicate matches, performs validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/c') }, expected: { status: 400 } },
{ description: 'when predicate does not match, skips validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/x') }, expected: { status: 200 } },
].each do |description:, accept_request_filter:, expected:|
].each do |h|
description = h[:description]
accept_request_filter = h[:accept_request_filter]
expected = h[:expected]
it description do
@app = new_rack_app(prefix: '/v1', schema: open_api_3_schema, accept_request_filter: accept_request_filter)

Expand Down
5 changes: 4 additions & 1 deletion test/middleware/request_validation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,10 @@ def app
{ description: 'when not specified, includes everything', accept_request_filter: nil, expected: { status: 400 } },
{ description: 'when predicate matches, performs validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/a') }, expected: { status: 400 } },
{ description: 'when predicate does not match, skips validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/x') }, expected: { status: 200 } },
].each do |description:, accept_request_filter:, expected:|
].each do |h|
description = h[:description]
accept_request_filter = h[:accept_request_filter]
expected = h[:expected]
it description do
@app = new_rack_app(prefix: '/v1', schema: hyper_schema, accept_request_filter: accept_request_filter)

Expand Down
12 changes: 10 additions & 2 deletions test/middleware/response_validation_open_api_3_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def app
{ check_header: false, description: 'valid value', header: { 'integer' => 1 }, expected: { status: 200 } },
{ check_header: false, description: 'missing value', header: { 'integer' => nil }, expected: { status: 200 } },
{ check_header: false, description: 'invalid value', header: { 'integer' => 'x' }, expected: { status: 200 } },
].each do |check_header:, description:, header:, expected:|
].each do |h|
check_header = h[:check_header]
description = h[:description]
header = h[:header]
expected = h[:expected]
describe "when #{check_header}" do
%w(get post put patch delete).each do |method|
describe method do
Expand Down Expand Up @@ -174,7 +178,11 @@ def app
{ description: 'when not specified, includes everything', accept_request_filter: nil, expected: { status: 500 } },
{ description: 'when predicate matches, performs validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/c') }, expected: { status: 500 } },
{ description: 'when predicate does not match, skips validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/x') }, expected: { status: 200 } },
].each do |description:, accept_request_filter:, expected:|
].each do |h|
description = h[:description]
accept_request_filter = h[:accept_request_filter]
expected = h[:expected]

it description do
@app = new_response_rack('not_json', {}, schema: open_api_3_schema, prefix: '/v1', accept_request_filter: accept_request_filter)

Expand Down
5 changes: 4 additions & 1 deletion test/middleware/response_validation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def app
{ description: 'when not specified, includes everything', accept_request_filter: nil, expected: { status: 500 } },
{ description: 'when predicate matches, performs validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/a') }, expected: { status: 500 } },
{ description: 'when predicate does not match, skips validation', accept_request_filter: -> (request) { request.path.start_with?('/v1/x') }, expected: { status: 200 } },
].each do |description:, accept_request_filter:, expected:|
].each do |h|
description = h[:description]
accept_request_filter = h[:accept_request_filter]
expected = h[:expected]
it description do
@app = new_rack_app('not_json', {}, schema: hyper_schema, prefix: '/v1', accept_request_filter: accept_request_filter)

Expand Down

0 comments on commit c7fa422

Please sign in to comment.