README.md in fitting-2.3.0 vs README.md in fitting-2.4.0
- old
+ new
@@ -2,10 +2,11 @@
<a href="https://funbox.ru">
<img src="https://funbox.ru/badges/sponsored_by_funbox.svg" alt="Sponsored by FunBox" width=250 />
</a>
+[](https://badge.fury.io/rb/fitting)
[](https://travis-ci.org/funbox/fitting)
This gem will help you implement your API in strict accordance to the documentation in [API Blueprint](https://apiblueprint.org/) format.
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.
@@ -25,20 +26,22 @@
$ gem install fitting
## Usage
+In your `.fitting.yml`:
+
+```yaml
+apib_path: /path/to/doc.apib
+```
+
In your `spec_helper.rb`:
```ruby
require 'fitting'
Fitting.statistics
-
-Fitting.configure do |config|
- config.apib_path = '/path/to/doc.apib'
-end
```
or
```ruby
@@ -53,14 +56,10 @@
config.after(:suite) do
responses.statistics.save
end
end
-
-Fitting.configure do |config|
- config.apib_path = '/path/to/doc.apib'
-end
```
## Example output
After running tests you will get statistics in the file `fitting/stats`:
@@ -140,42 +139,80 @@
Default: all paths. This is an array of paths that are mandatory for implementation.
This list does not affect the work of the matcher.
This list is only for the report in the console.
-```ruby
-config.white_list = {
- '/users' => ['DELETE', 'POST'],
- '/users/{id}' => ['GET', 'PATCH'],
- '/users/{id}/employees' => ['GET'],
- '/sessions' => []
-}
+```yaml
+white_list:
+ /users:
+ - DELETE
+ - POST
+ /users/{id}:
+ - GET
+ - PATCH
+ /users/{id}/employees:
+ - GET
+ /sessions: []
```
Empty array `[]` means all methods.
### resource_white_list
Default: all resources. This is an array of resources that are mandatory for implementation.
This list does not affect the work of the matcher.
This list is only for the report in the console.
-```ruby
-config.resource_white_list = {
- '/users' => ['DELETE /users/{id}', 'POST /users', 'GET /users/{id}', 'PATCH /users/{id}'],
- '/users/{id}/employees' => ['GET /users/{id}/employees'],
- '/sessions' => []
-}
+```yaml
+resource_white_list:
+ /users:
+ - DELETE /users/{id}
+ - POST /users
+ - GET /users/{id}
+ - PATCH /users/{id}
+ /users/{id}/employees:
+ - GET /users/{id}/employees
+ /sessions: []
```
Empty array `[]` means all methods.
+### include_resources
+
+Default: all resources if `include_resources` and `include_actions` is not used.
+This is an array of resources that are mandatory for implementation.
+This list does not affect the work of the matcher.
+This list is only for the report in the console.
+
+```yaml
+include_resources:
+ - /sessions
+```
+
+### include_actions
+
+Default: all paths if `include_resources` and `include_actions` is not used.
+This is an array of paths that are mandatory for implementation.
+This list does not affect the work of the matcher.
+This list is only for the report in the console.
+
+```yaml
+include_actions:
+ - DELETE /users/{id}
+ - POST /users
+ - GET /users/{id}
+ - PATCH /users/{id}
+ - GET /users/{id}/employees
+```
+
### ignore_list
You can use ignore list for omit checks with matchers.
-```ruby
-config.ignore_list = [%r{/api/v1/users/[1-9].}, %r{/api/v1/comments}]
+```yaml
+ignore_list:
+ - %r{/api/v1/users/[1-9].}
+ - %r{/api/v1/comments}
```
It's work only for match_schema (NOT FOR strictly_match_schema)
## Contributing