fitting 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 587fd41b2b12c20bbacc053f70f7e9f7daa1f866
4
- data.tar.gz: db1f83a7fd72f7d556bb43b957d1de236b76f5ea
3
+ metadata.gz: c4da6330584b695ce8964a021a89fbf7e5d6c73e
4
+ data.tar.gz: 5972f7305b5eaf446e738d6bf3d68dda0772c804
5
5
  SHA512:
6
- metadata.gz: c637ed7b9d401ee99b08b59cd2934f147fb64d55dc24f0f9c7572632695e9280af1aaf849876cbaf3c1d95dfcbd1252c64b5b0c5cd184c710d3d1e21d470b8ec
7
- data.tar.gz: ba647de857ecf54c62b169b10d60884666a2847d71764131f96a7d78fcbbfc0bc84fa85f9c9775ea9d8ad364b1cedd2ec9e9ffcce377d5e0d4d21777b1d706f2
6
+ metadata.gz: 14b06b29a08066358392409e23dd9813d6a8fdaede35aa7b975356064266be5e32d6a0ed3f27931f80c636a884252cc8c972a40b0c1f227804768d5c4a3171b4
7
+ data.tar.gz: 8200a2a160af99edf0b163157f0db626241361100770e2915cb19f39b622efe43bf8cd26560f00b25b04d6b46e21d1235552543b856296b5e30240a2cf041979
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/funbox/fitting.svg?branch=master)](https://travis-ci.org/funbox/fitting)
4
4
 
5
- This gem will help to realize your API in strict accordance with the documentation in the format API Bluprint.
6
- To do this, when you run your RSpes tests on the controller, in the documentation automatically searches for the json-schema and then validate it with a response in the test.
5
+ This gem will help you implement your API in strict accordance to the documentation in [API Bluprint](https://apiblueprint.org/) format.
6
+ To do this, when you run your RSpec tests on controllers, it automatically searches for the corresponding json-schemas in the documentation and then validates responses with them.
7
7
 
8
8
  ## Installation
9
9
 
@@ -27,55 +27,59 @@ In your `spec_helper.rb`:
27
27
 
28
28
  ```ruby
29
29
  Fitting.configure do |config|
30
- config.apib_path = `doc.apib`
30
+ config.apib_path = '/path/to/doc.apib'
31
31
  end
32
32
  ```
33
33
 
34
34
  ## Example output
35
35
 
36
- After running tests you will get statistics in the console.
36
+ After running tests you will get statistics in the console:
37
37
 
38
38
  ```
39
39
  Fully conforming requests:
40
40
  DELETE /api/v1/book ✔ 200 ✔ 201 ✔ 404
41
41
  DELETE /api/v1/book/{id} ✔ 200 ✔ 201 ✔ 404
42
42
  GET /api/v1/book/{id}/seller ✔ 200 ✔ 201 ✔ 404
43
-
43
+
44
44
  Partially conforming requests:
45
45
  GET /api/v1/book ✖ 200 ✔ 404
46
46
  POST /api/v1/book ✖ 200 ✔ 201 ✔ 404
47
47
  GET /api/v1/book/{id} ✖ 200 ✔ 404 ✔ 200
48
48
  PATCH /api/v1/book/{id} ✖ 200 ✔ 201 ✔ 404
49
-
49
+
50
50
  Non-conforming requests:
51
51
  GET /api/v1/seller ✖ 200 ✖ 201 ✖ 404
52
52
  GET /api/v1/buyer ✖ 200 ✖ 404
53
-
53
+
54
54
  API requests with fully implemented responses: 3 (33.33% of 9).
55
55
  API requests with partially implemented responses: 4 (44.44% of 9).
56
56
  API requests with no implemented responses: 2 (22.22% of 9).
57
-
57
+
58
58
  API responses conforming to the blueprint: 16 (64.00% of 25).
59
59
  API responses with validation errors or untested: 9 (36.00% of 25).
60
60
  ```
61
61
 
62
62
  ## Matchers
63
63
 
64
- If you want know describe why you get crosses instead of checkmarks you can use matchers for RSpec.
64
+ If you want to know why you get crosses instead of checkmarks you can use matchers for RSpec.
65
+
66
+ ```ruby
67
+ config.include Fitting::Matchers, type: :controller
68
+ ```
65
69
 
66
70
  ### match_response
67
71
 
68
- Makes a simple validation JSON Schema.
72
+ Makes a simple validation against JSON Schema.
69
73
 
70
- ```
74
+ ```ruby
71
75
  expect(response).to match_response
72
76
  ```
73
77
 
74
78
  ### strict_match_response
75
79
 
76
- Makes a strict validation JSON Schema. All properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`.
80
+ Makes a strict validation against JSON Schema. All properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`.
77
81
 
78
- ```
82
+ ```ruby
79
83
  expect(response).to strict_match_response
80
84
  ```
81
85
 
@@ -83,29 +87,29 @@ expect(response).to strict_match_response
83
87
 
84
88
  ### apib_path
85
89
 
86
- Path for API Blueprint documentation. There must be an installed library [drafter](https://github.com/apiaryio/drafter).
90
+ Path to API Blueprint documentation. There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
87
91
 
88
92
  ### drafter_yaml_path
89
93
 
90
- Path for API Blueprint documentation after use drafter and transformation in yaml.
94
+ Path to API Blueprint documentation pre-parsed with `drafter` and saved to a YAML file.
91
95
 
92
96
  ### necessary_fully_implementation_of_responses
93
97
 
94
- Default `true`. It returns `exit 1` if not implemented all(with tests expect match response) the responses.
98
+ Default `true`. It returns `exit 1` if not all responses are implemented according to the documentation. For this to work, `match_response` (see above) should run.
95
99
 
96
100
  ### strict
97
101
 
98
- Default `false`. If `true` than all properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`.
102
+ Default `false`. If `true` then all properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`.
99
103
 
100
104
  ### prefix
101
105
 
102
- Prefix for request.
106
+ Prefix of API requests. Example: `'/api'`.
103
107
 
104
108
  ### white_list
105
109
 
106
- Default all resources. This is an array of resources that are mandatory for implementation.
107
- This list does not affect the work of the match expert.
108
- This list is only for the report in the console and verify implementation.
110
+ Default: all resources. This is an array of resources that are mandatory for implementation.
111
+ This list does not affect the work of the matcher.
112
+ This list is only for the report in the console.
109
113
 
110
114
  ```ruby
111
115
  config.white_list = {
@@ -118,20 +122,14 @@ config.white_list = {
118
122
 
119
123
  Empty array `[]` means all methods.
120
124
 
121
- Result be two statistic for two list.
122
-
123
125
  ### create_report_with_name
124
126
 
125
- Create report with name.
127
+ File name for the report.
126
128
 
127
129
  ### show_statistics_in_console
128
130
 
129
131
  Default `true`.
130
132
 
131
- ## Report
132
-
133
- Autogenerate `report_request_by_response.yaml` and `report_response.yaml reports`.
134
-
135
133
  ## Contributing
136
134
 
137
135
  Bug reports and pull requests are welcome on GitHub at https://github.com/funbox/fitting. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/fitting.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['d.efimov@fun-box.ru']
11
11
 
12
12
  spec.summary = 'Validation in the rspec of API Blueprint'
13
- spec.description = 'Validation requests and responses in the rspec with the help of API Blueprint'
13
+ spec.description = 'Validation responses in the rspec with the help of API Blueprint'
14
14
  spec.homepage = 'https://github.com/funbox/fitting'
15
15
  spec.license = 'MIT'
16
16
 
data/lib/fitting/route.rb CHANGED
@@ -5,9 +5,13 @@ require 'fitting/route/responses'
5
5
  module Fitting
6
6
  class Route
7
7
  def initialize(all_responses, routes, strict)
8
- coverage = Fitting::Route::Coverage.new(all_responses, routes, strict)
9
- @requests = Fitting::Route::Requests.new(coverage)
10
- @responses = Fitting::Route::Responses.new(routes, coverage)
8
+ @coverage = Fitting::Route::Coverage.new(all_responses, routes, strict)
9
+ @requests = Fitting::Route::Requests.new(@coverage)
10
+ @responses = Fitting::Route::Responses.new(routes, @coverage)
11
+ end
12
+
13
+ def not_coverage?
14
+ @coverage.not_coverage.present?
11
15
  end
12
16
 
13
17
  def statistics
@@ -9,7 +9,7 @@ module Fitting
9
9
  end
10
10
 
11
11
  def not_coverage?
12
- @white_route.not_coverage.present?
12
+ @white_route.not_coverage?
13
13
  end
14
14
 
15
15
  def save(name)
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.6.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitting
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.efimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema
@@ -212,7 +212,7 @@ dependencies:
212
212
  - - ">="
213
213
  - !ruby/object:Gem::Version
214
214
  version: 0.43.0
215
- description: Validation requests and responses in the rspec with the help of API Blueprint
215
+ description: Validation responses in the rspec with the help of API Blueprint
216
216
  email:
217
217
  - d.efimov@fun-box.ru
218
218
  executables: []