README.md in fitting-1.6.2 vs README.md in fitting-2.0.0

- old
+ new

@@ -24,18 +24,44 @@ ## Usage In your `spec_helper.rb`: ```ruby - Fitting.configure do |config| - config.apib_path = '/path/to/doc.apib' +require 'fitting' + +Fitting.statistics + +Fitting.configure do |config| + config.apib_path = '/path/to/doc.apib' +end +``` + +or + +```ruby +require 'fitting' + +responses = Fitting::Storage::Responses.new + +RSpec.configure do |config| + config.after(:each, type: :controller) do + responses.add(response) end + + 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 console: +After running tests you will get statistics in the file `fitting/stats`: ``` Fully conforming requests: DELETE /api/v1/book ✔ 200 ✔ 201 ✔ 404 DELETE /api/v1/book/{id} ✔ 200 ✔ 201 ✔ 404 @@ -57,32 +83,34 @@ API responses conforming to the blueprint: 16 (64.00% of 25). API responses with validation errors or untested: 9 (36.00% of 25). ``` +Also you will get not covered responses in the file `fitting/not_covered`. + ## Matchers If you want to know why you get crosses instead of checkmarks you can use matchers for RSpec. ```ruby config.include Fitting::Matchers, type: :controller ``` -### match_response +### match_schema Makes a simple validation against JSON Schema. ```ruby -expect(response).to match_response +expect(response).to match_schema ``` -### strict_match_response +### strictly_match_schema Makes a strict validation against JSON Schema. All properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`. ```ruby -expect(response).to strict_match_response +expect(response).to strictly_match_schema ``` ## Config ### apib_path @@ -91,14 +119,10 @@ ### drafter_yaml_path Path to API Blueprint documentation pre-parsed with `drafter` and saved to a YAML file. -### necessary_fully_implementation_of_responses - -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. - ### strict Default `false`. If `true` then all properties are condisidered to have `"required": true` and all objects `"additionalProperties": false`. ### prefix @@ -119,17 +143,9 @@ '/sessions' => [] } ``` Empty array `[]` means all methods. - -### create_report_with_name - -File name for the report. - -### show_statistics_in_console - -Default `true`. ## Contributing 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.