fitting 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 265b481959df21a8bbfa2766b49fab8b54696c46
4
+ data.tar.gz: 40f11cf6aa262f56538348d6ec91662db7acf8c5
5
+ SHA512:
6
+ metadata.gz: 6be0a7165bfecd1055231c8b1708970bce611082107cb74139c500f41f391cb0333b1ce553491bd65ec43d0ef71f00fdefd6b61a4d73e3f1b63a0a84e204a7f7
7
+ data.tar.gz: 68160e93f7e1f9f46a7d07728eb2a06e4740bedc32951e465c0e63b21cf793f774bf8cdc6713d90fb5f992fa00b55c6ca08448e7318ec2b6b7eac12adf1ceb2a
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
11
+ .byebug_history
12
+ report_response_macro.yaml
13
+ report_response_micro.yaml
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.0
3
+
4
+ Metrics/LineLength:
5
+ Max: 120
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Style/FrozenStringLiteralComment:
11
+ Enabled: false
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at d.efimov@fun-box.ru. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 d.efimov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Fitting
2
+
3
+ This gem will help to make your tests according to the documentation for the API.
4
+
5
+ When writing tests, you can be sure that the implement API in accordance with documentation on API Blueprint.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fitting'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fitting
22
+
23
+ ## Usage
24
+
25
+ ### rspec-rails
26
+
27
+ rails_helper.rb
28
+
29
+ ```ruby
30
+ require 'fitting'
31
+ config.after(:each, :type => :controller) do
32
+ Fitting::Documentation.try_on(request, response)
33
+ end
34
+ ```
35
+
36
+ ### Formatting
37
+
38
+ ```
39
+ bundle exec rspec --format Fitting::Formatter::Response::MacroYaml
40
+ ```
41
+
42
+ or
43
+
44
+ ```
45
+ bundle exec rspec --format Fitting::Formatter::Response::MicroYaml
46
+ ```
47
+
48
+ After that you can find the report in `rreport_response_macro.yaml` or `report_response_micro.yaml`.
49
+
50
+ ## Config
51
+
52
+ ### tomogram
53
+
54
+ This gem takes a simplified format json convert from API Blueprint which we have called API Tomogram.
55
+
56
+ Use gem tomograph.
57
+
58
+ ```ruby
59
+ Fitting.configure do |config|
60
+ config.tomogram = 'tomogram.json'
61
+ end
62
+
63
+ ```
64
+
65
+ ### skip_not_documented
66
+
67
+ Default true.
68
+
69
+ ### validation_requests
70
+
71
+ Default true.
72
+
73
+ ### validation_response
74
+
75
+ Default true.
76
+
77
+ ## Contributing
78
+
79
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/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.
80
+
81
+ ## License
82
+
83
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'fitting'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/fitting.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fitting/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'fitting'
8
+ spec.version = Fitting::VERSION
9
+ spec.authors = ['d.efimov']
10
+ spec.email = ['d.efimov@fun-box.ru']
11
+
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'
14
+ spec.homepage = 'https://github.com/funbox/fitting'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_runtime_dependency 'json-schema', '~> 2.6', '>= 2.6.2'
23
+ spec.add_runtime_dependency 'tomogram_routing', '~> 0.1', '>= 0.1.0'
24
+ spec.add_runtime_dependency 'multi_json'
25
+ spec.add_development_dependency 'bundler', '~> 1.12'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'byebug', '~> 8.2', '>= 8.2.1'
28
+ spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
29
+ spec.add_development_dependency 'simplecov', '~> 0.11', '>= 0.11.2'
30
+ spec.add_development_dependency 'rubocop', '~> 0.43', '>= 0.43.0'
31
+ end
@@ -0,0 +1,14 @@
1
+ module Fitting
2
+ class Configuration
3
+ attr_accessor :tomogram,
4
+ :skip_not_documented,
5
+ :validation_requests,
6
+ :validation_response
7
+
8
+ def initialize
9
+ @skip_not_documented = true
10
+ @validation_requests = true
11
+ @validation_response = true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,42 @@
1
+ require 'tomogram_routing'
2
+ require 'json-schema'
3
+ require 'fitting/storage/yaml_file'
4
+ require 'fitting/request'
5
+ require 'fitting/response'
6
+
7
+ module Fitting
8
+ class Documentation
9
+ class << self
10
+ def try_on(date, env_request, env_response)
11
+ request = Request.new(env_request, tomogram)
12
+ request.valid! if request.validate?
13
+ response = Response.new(env_response, request.schema)
14
+ response.valid! if response.validate?
15
+ add_storage(location(date), request, response)
16
+ end
17
+
18
+ private
19
+
20
+ def add_storage(location, request, response)
21
+ Fitting::Storage::YamlFile.push(
22
+ location,
23
+ 'request' => MultiJson.dump(request.to_hash),
24
+ 'response' => MultiJson.dump(response.to_hash)
25
+ )
26
+ end
27
+
28
+ def tomogram
29
+ @tomogram ||= TomogramRouting::Tomogram.craft(Fitting.configuration.tomogram)
30
+ end
31
+
32
+ def location(date)
33
+ name = date.inspect.to_s
34
+ if name.split('(').size > 1
35
+ name.split('(').last.split(')').first[2..-1]
36
+ else
37
+ name.split(' ')[3][2..-3]
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,36 @@
1
+ require 'rspec/core/formatters/base_formatter'
2
+ require 'yaml'
3
+ require 'fitting/storage/yaml_file'
4
+ require 'fitting/report/response/macro'
5
+
6
+ module Fitting
7
+ module Formatter
8
+ module Response
9
+ class MacroYaml < RSpec::Core::Formatters::BaseFormatter
10
+ RSpec::Core::Formatters.register self, :start, :stop
11
+
12
+ def start(_notification)
13
+ Fitting::Storage::YamlFile.craft
14
+ end
15
+
16
+ def stop(_notification)
17
+ tests = Fitting::Storage::YamlFile.load
18
+ Fitting::Storage::YamlFile.destroy
19
+
20
+ if tests
21
+ report = Report::Response::Macro.new(tests).to_hash
22
+ else
23
+ report = 'no tests controllers'
24
+ end
25
+ craft_json(report)
26
+ end
27
+
28
+ def craft_json(report)
29
+ File.open('report_response_macro.yaml', 'w') do |file|
30
+ file.write(YAML.dump(report))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,36 @@
1
+ require 'rspec/core/formatters/base_formatter'
2
+ require 'yaml'
3
+ require 'fitting/storage/yaml_file'
4
+ require 'fitting/report/response/micro'
5
+
6
+ module Fitting
7
+ module Formatter
8
+ module Response
9
+ class MicroYaml < RSpec::Core::Formatters::BaseFormatter
10
+ RSpec::Core::Formatters.register self, :start, :stop
11
+
12
+ def start(_notification)
13
+ Fitting::Storage::YamlFile.craft
14
+ end
15
+
16
+ def stop(_notification)
17
+ tests = Fitting::Storage::YamlFile.load
18
+ Fitting::Storage::YamlFile.destroy
19
+
20
+ if tests
21
+ report = Report::Response::Micro.new(tests).to_hash
22
+ else
23
+ report = 'no tests controllers'
24
+ end
25
+ craft_json(report)
26
+ end
27
+
28
+ def craft_json(report)
29
+ File.open('report_response_micro.yaml', 'w') do |file|
30
+ file.write(YAML.dump(report))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,89 @@
1
+ module Fitting
2
+ module Report
3
+ module Response
4
+ class Macro
5
+ def initialize(tests)
6
+ @json = responses(tests)
7
+ end
8
+
9
+ def responses(tests)
10
+ data = {
11
+ 'not_documented' => {},
12
+ 'invalid' => {},
13
+ 'valid' => {}
14
+ }
15
+ full_responses = {}
16
+
17
+ tests.map do |location, test|
18
+ request = MultiJson.load(test['request'])
19
+ response = MultiJson.load(test['response'])
20
+ if request['schema'].nil?
21
+ data['not_documented'][response_key(request, response)] = [location]
22
+ else
23
+ if response['schemas'].nil?
24
+ data['not_documented'][response_key(request['schema'], response)] = [location]
25
+ else
26
+ responses_documented(location, response['valid'], data, response_key(request['schema'], response), full_responses, response)
27
+ end
28
+ end
29
+ end
30
+
31
+ not_cover = {}
32
+ full_responses.map do |response, date|
33
+ date['cases'].map do |one_case|
34
+ if not_cover["#{response} #{one_case}"]
35
+ not_cover["#{response} #{one_case}"] = not_cover["#{response} #{one_case}"] + [date['test']]
36
+ else
37
+ not_cover["#{response} #{one_case}"] = [date['test']]
38
+ end
39
+ end
40
+ end
41
+ data['not_cover_where_either'] = not_cover
42
+ data
43
+ end
44
+
45
+ def responses_documented(location, valid, data, name, full_responses, response)
46
+ if valid
47
+ unless full_responses[name]
48
+ full_responses[name] = {}
49
+ full_responses[name]['cases'] = (0..response['schemas'].size-1).to_a
50
+ end
51
+ full_responses[name]['test'] = location
52
+ full_responses[name]['cases'].delete(find_index(response))
53
+ push('valid', data, "#{name} #{find_index(response)}", location)
54
+ else
55
+ push('invalid', data, name, location)
56
+ end
57
+ end
58
+
59
+ def find_index(response)
60
+ response['schemas'].size.times do |i|
61
+ if response['fully_validates'][i] == []
62
+ return i
63
+ end
64
+ end
65
+ end
66
+
67
+ def push(key, data, name, location)
68
+ data[key] = if data[key][name]
69
+ data[key].merge(name => data[key][name] + [location])
70
+ else
71
+ data[key].merge(name => [location])
72
+ end
73
+ end
74
+
75
+ def request_key(request_data)
76
+ "#{request_data['method']} #{request_data['path']}"
77
+ end
78
+
79
+ def response_key(request_data, response_data)
80
+ "#{request_key(request_data)} #{response_data['status']}"
81
+ end
82
+
83
+ def to_hash
84
+ @json
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,76 @@
1
+ require 'multi_json'
2
+
3
+ module Fitting
4
+ module Report
5
+ module Response
6
+ class Micro
7
+ def initialize(tests)
8
+ @json = responses(tests)
9
+ end
10
+
11
+ def responses(tests)
12
+ data = {}
13
+
14
+ tests.map do |location, test|
15
+ request = MultiJson.load(test['request'])
16
+ response = MultiJson.load(test['response'])
17
+ if request['schema'].nil?
18
+ data[location] = {
19
+ 'status' => 'not_documented',
20
+ 'got' => response['body']
21
+ }
22
+ else
23
+ if response['schemas'].nil?
24
+ data[location] = {
25
+ 'status' => 'not_documented',
26
+ 'got' => response['body']
27
+ }
28
+ else
29
+ responses_documented(location, data, response)
30
+ end
31
+ end
32
+ end
33
+
34
+ data
35
+ end
36
+
37
+ def responses_documented(location, data, response)
38
+ if response['valid']
39
+ expect_body = {}
40
+
41
+ response['schemas'].size.times do |i|
42
+ if response['fully_validates'][i] == []
43
+ expect_body = response['schemas'][i]
44
+ end
45
+ end
46
+
47
+ data[location] = {
48
+ 'status' => 'valid',
49
+ 'got' => response['body'],
50
+ 'expect' => MultiJson.dump(expect_body)
51
+ }
52
+ else
53
+ fully_validates = response['fully_validates'].map do |fully_validate|
54
+ MultiJson.dump(fully_validate)
55
+ end
56
+
57
+ schemas = response['schemas'].map do |schema|
58
+ MultiJson.dump(schema)
59
+ end
60
+
61
+ data[location] = {
62
+ 'status' => 'invalid',
63
+ 'got' => response['body'],
64
+ 'diff' => fully_validates,
65
+ 'expected' => schemas
66
+ }
67
+ end
68
+ end
69
+
70
+ def to_hash
71
+ @json
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,35 @@
1
+ module Fitting
2
+ class Request
3
+ attr_accessor :path, :method, :body, :schema
4
+
5
+ class Unsuitable < RuntimeError; end
6
+ class NotDocumented < RuntimeError; end
7
+
8
+ def initialize(env_request, tomogram)
9
+ @method = env_request.request_method
10
+ @path = env_request.env['PATH_INFO']
11
+ @body = env_request.env['action_dispatch.request.request_parameters']
12
+ @schema = tomogram.find_request(method: @method, path: @path)
13
+ raise NotDocumented unless @schema || Fitting.configuration.skip_not_documented
14
+ self
15
+ end
16
+
17
+ def valid!
18
+ res = JSON::Validator.fully_validate(@schema['request'], @body)
19
+ raise Unsuitable unless res.empty?
20
+ end
21
+
22
+ def validate?
23
+ @schema && Fitting.configuration.validation_requests
24
+ end
25
+
26
+ def to_hash
27
+ {
28
+ 'method' => @method,
29
+ 'path' => @path,
30
+ 'body' => @body,
31
+ 'schema' => @schema
32
+ }
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,46 @@
1
+ module Fitting
2
+ class Response
3
+ attr_accessor :status, :body, :schemas
4
+
5
+ class Unsuitable < RuntimeError; end
6
+ class NotDocumented < RuntimeError; end
7
+
8
+ def initialize(env_response, expect_request)
9
+ @status = env_response.status
10
+ @body = env_response.body
11
+ @schemas = expect_request.find_responses(status: @status).map{|response|response['body']} if expect_request
12
+ @fully_validates = set_fully_validate if @schemas
13
+ raise Response::NotDocumented unless (@schemas&.first) || Fitting.configuration.skip_not_documented
14
+ self
15
+ end
16
+
17
+ def valid!
18
+ raise Unsuitable unless @valid
19
+ end
20
+
21
+ def set_fully_validate
22
+ @valid = false
23
+ fully_validates = []
24
+ @schemas.map do |old_schema|
25
+ fully_validate = JSON::Validator.fully_validate(old_schema, @body)
26
+ fully_validates.push(fully_validate)
27
+ @valid = true if fully_validate == []
28
+ end
29
+ fully_validates
30
+ end
31
+
32
+ def validate?
33
+ @schemas&.first && Fitting.configuration.validation_response
34
+ end
35
+
36
+ def to_hash
37
+ {
38
+ 'status' => @status,
39
+ 'body' => @body,
40
+ 'schemas' => @schemas,
41
+ 'fully_validates' => @fully_validates,
42
+ 'valid' => @valid
43
+ }
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,37 @@
1
+ require 'multi_json'
2
+
3
+ module Fitting
4
+ module Storage
5
+ class JsonFile
6
+ NAME = 'storage.json'.freeze
7
+
8
+ def self.craft
9
+ save({})
10
+ end
11
+
12
+ def self.save(json)
13
+ File.open(NAME, 'w') do |file|
14
+ file.write(MultiJson.dump(json))
15
+ end
16
+ end
17
+
18
+ def self.push(key, value)
19
+ save(tests.merge(key => value))
20
+ rescue
21
+ end
22
+
23
+ def self.tests
24
+ MultiJson.load(File.read(NAME))
25
+ rescue
26
+ end
27
+
28
+ def self.load
29
+ MultiJson.load(File.read(NAME))
30
+ end
31
+
32
+ def self.destroy
33
+ File.delete(NAME)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ require 'yaml'
2
+
3
+ module Fitting
4
+ module Storage
5
+ class YamlFile
6
+ NAME = 'storage.yaml'.freeze
7
+
8
+ def self.craft
9
+ save("---\n")
10
+ end
11
+
12
+ def self.save(json)
13
+ File.open(NAME, 'w') do |file|
14
+ file.write(json)
15
+ end
16
+ end
17
+
18
+ def self.push(key, value)
19
+ save(tests + YAML.dump(key => value)[4..-1])
20
+ rescue
21
+ end
22
+
23
+ def self.tests
24
+ File.read(NAME)
25
+ rescue
26
+ end
27
+
28
+ def self.load
29
+ YAML.load(File.read(NAME))
30
+ end
31
+
32
+ def self.destroy
33
+ File.delete(NAME)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Fitting
2
+ VERSION = '0.3.0'.freeze
3
+ end
data/lib/fitting.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'fitting/version'
2
+ require 'fitting/documentation'
3
+ require 'fitting/configuration'
4
+ require 'fitting/formatter/response/macro_yaml'
5
+ require 'fitting/formatter/response/micro_yaml'
6
+
7
+ module Fitting
8
+ class << self
9
+ def configure
10
+ yield configuration
11
+ end
12
+
13
+ def configuration
14
+ @configuration ||= Configuration.new
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,228 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fitting
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - d.efimov
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json-schema
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.6'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.6.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.6'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.6.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: tomogram_routing
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.1.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.1.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: multi_json
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: bundler
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '1.12'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.12'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rake
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '10.0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '10.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: byebug
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '8.2'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 8.2.1
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '8.2'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 8.2.1
115
+ - !ruby/object:Gem::Dependency
116
+ name: rspec
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: '3.4'
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 3.4.0
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.4'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 3.4.0
135
+ - !ruby/object:Gem::Dependency
136
+ name: simplecov
137
+ requirement: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "~>"
140
+ - !ruby/object:Gem::Version
141
+ version: '0.11'
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.11.2
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.11'
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 0.11.2
155
+ - !ruby/object:Gem::Dependency
156
+ name: rubocop
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '0.43'
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 0.43.0
165
+ type: :development
166
+ prerelease: false
167
+ version_requirements: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '0.43'
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: 0.43.0
175
+ description: Validation requests and responses in the rspec with the help of API Blueprint
176
+ email:
177
+ - d.efimov@fun-box.ru
178
+ executables: []
179
+ extensions: []
180
+ extra_rdoc_files: []
181
+ files:
182
+ - ".gitignore"
183
+ - ".rubocop.yml"
184
+ - CODE_OF_CONDUCT.md
185
+ - Gemfile
186
+ - LICENSE.txt
187
+ - README.md
188
+ - Rakefile
189
+ - bin/console
190
+ - bin/setup
191
+ - fitting.gemspec
192
+ - lib/fitting.rb
193
+ - lib/fitting/configuration.rb
194
+ - lib/fitting/documentation.rb
195
+ - lib/fitting/formatter/response/macro_yaml.rb
196
+ - lib/fitting/formatter/response/micro_yaml.rb
197
+ - lib/fitting/report/response/macro.rb
198
+ - lib/fitting/report/response/micro.rb
199
+ - lib/fitting/request.rb
200
+ - lib/fitting/response.rb
201
+ - lib/fitting/storage/json_file.rb
202
+ - lib/fitting/storage/yaml_file.rb
203
+ - lib/fitting/version.rb
204
+ homepage: https://github.com/funbox/fitting
205
+ licenses:
206
+ - MIT
207
+ metadata: {}
208
+ post_install_message:
209
+ rdoc_options: []
210
+ require_paths:
211
+ - lib
212
+ required_ruby_version: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: '0'
217
+ required_rubygems_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ requirements: []
223
+ rubyforge_project:
224
+ rubygems_version: 2.5.1
225
+ signing_key:
226
+ specification_version: 4
227
+ summary: Validation in the rspec of API Blueprint
228
+ test_files: []