committee-rails 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +7 -6
- 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: 3c9e031103394dc6740d2597e215982bc98fc9c3b05cdf1a1e044f350043239e
|
4
|
+
data.tar.gz: 0f1c74128a7587828a6e5151caec8d4a2f5dda61d76d24072a133d8b9a4c948f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1038193906d81208ffcbad37fd2a19388d3b9c2978c4a6408cf2a751bd2606b0b74868d7da4689e77a8a9a0f2cbc5223fce36a248162911b54aab7e6ac32597a
|
7
|
+
data.tar.gz: 89f12a6200e0523519379b4aede4f4b98449998be4452e0ad2e4810f5090385fc716e9ac7c9e2dad1837520c4c15a62e83e968963415288ff5f3b98399808ca1
|
@@ -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
|
[![Build Status](https://travis-ci.org/willnet/committee-rails.svg?branch=master)](https://travis-ci.org/willnet/committee-rails)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/committee-rails.svg)](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
|
+
@request.original_fullpath
|
13
|
+
end
|
14
|
+
|
15
|
+
def path_info
|
16
|
+
@request.original_fullpath
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-15 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,6 +84,7 @@ 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
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
|
-
rubygems_version: 3.1.
|
109
|
+
rubygems_version: 3.1.6
|
109
110
|
signing_key:
|
110
111
|
specification_version: 4
|
111
112
|
summary: Committee for rails
|