committee-rails 0.5.1 → 0.6.1
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/.github/workflows/test.yml +59 -0
- data/README.md +16 -4
- data/committee-rails.gemspec +1 -1
- data/lib/committee/rails/request_object.rb +23 -0
- data/lib/committee/rails/test/methods.rb +3 -2
- data/lib/committee/rails/version.rb +1 -1
- metadata +10 -9
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e19964ad2115e5b0f54190b2344820e348a0eb72f849effeb858f8de704910d
|
4
|
+
data.tar.gz: bae294c11c43878b06c622f565592f907744b5900de46bb8730d8d442d9691c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5fd4324105b72c81e00e619a3ebd6ae77f0e98d936406a70b1619020335bee6a71424536e0953fc7672bea4301e405f0cfbebb81b2af10e5748ddfca75f6173
|
7
|
+
data.tar.gz: f7af49214f849fb58880d32ca7e38e9ef70868844d82d64499d76662ce912d4eaf4074109c1ade154e5d17e15633a9cc027884e61c98679901fe69c74f217076
|
@@ -0,0 +1,59 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
types:
|
9
|
+
- opened
|
10
|
+
- synchronize
|
11
|
+
- reopened
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
container: ${{ matrix.ruby }}
|
18
|
+
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
|
22
|
+
matrix:
|
23
|
+
ruby:
|
24
|
+
- ruby:2.4
|
25
|
+
- ruby:2.5
|
26
|
+
- ruby:2.6
|
27
|
+
- ruby:2.7
|
28
|
+
- ruby:3.0
|
29
|
+
- ruby:3.1
|
30
|
+
- rubylang/ruby:master-nightly-bionic
|
31
|
+
include:
|
32
|
+
- ruby: rubylang/ruby:master-nightly-bionic
|
33
|
+
allow_failures: "true"
|
34
|
+
|
35
|
+
steps:
|
36
|
+
- uses: actions/checkout@v2
|
37
|
+
|
38
|
+
- name: Cache vendor/bundle
|
39
|
+
uses: actions/cache@v1
|
40
|
+
id: cache_gem
|
41
|
+
with:
|
42
|
+
path: vendor/bundle
|
43
|
+
key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
|
44
|
+
restore-keys: |
|
45
|
+
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
46
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
47
|
+
|
48
|
+
- name: bundle update
|
49
|
+
run: |
|
50
|
+
set -xe
|
51
|
+
bundle config path vendor/bundle
|
52
|
+
bundle update --jobs $(nproc) --retry 3
|
53
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
54
|
+
|
55
|
+
- name: Run test
|
56
|
+
run: |
|
57
|
+
set -xe
|
58
|
+
bundle exec rake
|
59
|
+
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://travis-ci.org/willnet/committee-rails)
|
4
4
|
[](https://badge.fury.io/rb/committee-rails)
|
5
5
|
|
6
|
-
You can use `
|
6
|
+
You can use `assert_response_schema_confirm` in rails.
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -17,6 +17,10 @@ And then execute:
|
|
17
17
|
|
18
18
|
$ bundle
|
19
19
|
|
20
|
+
If you use committee prior to 4.4.0, you have to use committee-rails 0.5.x. Please see below.
|
21
|
+
|
22
|
+
[0.5 (0-5-stable) documentation](https://github.com/willnet/committee-rails/tree/0-5-stable)
|
23
|
+
|
20
24
|
If you use committee prior to 3.0, you have to use committee-rails 0.4.x. Please see below.
|
21
25
|
|
22
26
|
[0.4 (0-4-stable) documentation](https://github.com/willnet/committee-rails/tree/0-4-stable)
|
@@ -38,13 +42,17 @@ describe 'request spec' do
|
|
38
42
|
include Committee::Rails::Test::Methods
|
39
43
|
|
40
44
|
def committee_options
|
41
|
-
@committee_options ||= {
|
45
|
+
@committee_options ||= {
|
46
|
+
schema_path: Rails.root.join('schema', 'schema.json').to_s,
|
47
|
+
query_hash_key: 'rack.request.query_hash',
|
48
|
+
parse_response_by_content_type: false,
|
49
|
+
}
|
42
50
|
end
|
43
51
|
|
44
52
|
describe 'GET /' do
|
45
53
|
it 'conform json schema' do
|
46
54
|
get '/'
|
47
|
-
|
55
|
+
assert_response_schema_confirm(200)
|
48
56
|
end
|
49
57
|
end
|
50
58
|
end
|
@@ -56,7 +64,11 @@ If you use rspec, you can use very simple.
|
|
56
64
|
```ruby
|
57
65
|
RSpec.configure do |config|
|
58
66
|
config.add_setting :committee_options
|
59
|
-
config.committee_options = {
|
67
|
+
config.committee_options = {
|
68
|
+
schema_path: Rails.root.join('schema', 'schema.json').to_s,
|
69
|
+
query_hash_key: 'rack.request.query_hash',
|
70
|
+
parse_response_by_content_type: false,
|
71
|
+
}
|
60
72
|
end
|
61
73
|
```
|
62
74
|
|
data/committee-rails.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
|
-
spec.add_dependency 'committee', '>=
|
21
|
+
spec.add_dependency 'committee', '>= 4.4.0'
|
22
22
|
spec.add_dependency 'activesupport'
|
23
23
|
spec.add_dependency 'actionpack'
|
24
24
|
spec.add_dependency 'railties'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'action_dispatch/http/request'
|
2
|
+
|
3
|
+
module Committee::Rails
|
4
|
+
class RequestObject
|
5
|
+
delegate_missing_to :@request
|
6
|
+
|
7
|
+
def initialize(request)
|
8
|
+
@request = request
|
9
|
+
end
|
10
|
+
|
11
|
+
def path
|
12
|
+
URI.parse(@request.original_fullpath).path
|
13
|
+
end
|
14
|
+
|
15
|
+
def path_info
|
16
|
+
URI.parse(@request.original_fullpath).path
|
17
|
+
end
|
18
|
+
|
19
|
+
def request_method
|
20
|
+
@request.env['action_dispatch.original_request_method'] || @request.request_method
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'committee'
|
2
|
+
require 'committee/rails/request_object'
|
2
3
|
|
3
4
|
module Committee::Rails
|
4
5
|
module Test
|
@@ -9,7 +10,7 @@ module Committee::Rails
|
|
9
10
|
if defined?(RSpec) && (options = RSpec.try(:configuration).try(:committee_options))
|
10
11
|
options
|
11
12
|
else
|
12
|
-
{ schema_path: default_schema }
|
13
|
+
{ schema_path: default_schema, query_hash_key: 'rack.request.query_hash', parse_response_by_content_type: false }
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -18,7 +19,7 @@ module Committee::Rails
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def request_object
|
21
|
-
integration_session.request
|
22
|
+
@request_object ||= Committee::Rails::RequestObject.new(integration_session.request)
|
22
23
|
end
|
23
24
|
|
24
25
|
def response_data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: committee-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: committee
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,8 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/test.yml"
|
76
77
|
- ".gitignore"
|
77
|
-
- ".travis.yml"
|
78
78
|
- CODE_OF_CONDUCT.md
|
79
79
|
- Gemfile
|
80
80
|
- LICENSE.txt
|
@@ -84,13 +84,14 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- committee-rails.gemspec
|
86
86
|
- lib/committee/rails.rb
|
87
|
+
- lib/committee/rails/request_object.rb
|
87
88
|
- lib/committee/rails/test/methods.rb
|
88
89
|
- lib/committee/rails/version.rb
|
89
90
|
homepage: https://github.com/willnet/committee-rails
|
90
91
|
licenses:
|
91
92
|
- MIT
|
92
93
|
metadata: {}
|
93
|
-
post_install_message:
|
94
|
+
post_install_message:
|
94
95
|
rdoc_options: []
|
95
96
|
require_paths:
|
96
97
|
- lib
|
@@ -105,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
109
|
+
rubygems_version: 3.3.7
|
110
|
+
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Committee for rails
|
112
113
|
test_files: []
|