reqres_rspec 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fff2afe79f68435c6b2427a0956a13b7fcc745df
4
+ data.tar.gz: 8e5a3cc6f86c39a9298fd32eb95d3ab3173736db
5
+ SHA512:
6
+ metadata.gz: 2e2d2c9c66a38dc962c9e99e7bcbfda25851ce1de6fc9481289708e14fb11edf5180c49ee1458b8ddd541230fd13d71853ee29ee6b6a8e0acb33eb68b9c1c7f2
7
+ data.tar.gz: 38831de650a0ace22d13ccbcfa96b19ba9694d1c80f12954c6974be12d6e4dfd224538a042dd52ffd487ce87d227afe51385189c594c2eaa0e3fd7f3d4e36286
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
19
+ .rvmrc
20
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in reqres_rspec.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 rilian
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # ReqresRspec
2
+
3
+ Gem generates API documentation from your integration tests written with `rspec`. No additional DSL needed. Beside covering rspec tests, documentation may be extended with API controller action comments win `yardoc` style. Documentation is generated in JSON, YAML, HTML, PDF formats.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'reqres_rspec'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install reqres_rspec
18
+
19
+ ## Usage
20
+
21
+ ### Sample controller action
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ### Sample rspec test
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ### Generates documentation example
30
+
31
+ TODO: Write usage instructions here
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,41 @@
1
+ # to enable mattr_accessor
2
+ require "active_support/core_ext/module/attribute_accessors"
3
+
4
+ require "reqres_rspec/version"
5
+ require "reqres_rspec/collector"
6
+
7
+ module ReqresRspec
8
+ # Contains spec values read from rspec example, request and response
9
+ mattr_accessor :records
10
+
11
+ # define if all doc generation is enabled
12
+ mattr_accessor :enabled
13
+ end
14
+
15
+ ReqresRspec.enabled = defined?(RSpec)
16
+
17
+ if !ReqresRspec.enabled
18
+ puts "\nWARNING: ReqresRspec is disabled\n"
19
+ end
20
+
21
+ if ReqresRspec.enabled
22
+ # initialize
23
+ ReqresRspec.records = []
24
+
25
+ RSpec.configure do |config|
26
+ config.after(:each) do
27
+ if defined?(request) && defined?(response)
28
+ unless self.example.options.has_key?(:rspec_doc) && !self.example.options[:rspec_doc]
29
+ ReqresRspec::Collector.collect(self, request, response)
30
+ end
31
+ end
32
+ end
33
+
34
+ config.after(:suite) do
35
+ if ReqresRspec.records && ReqresRspec.records.size > 0
36
+ puts 'TODO: save records'
37
+ puts ReqresRspec.records.inspect
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,14 @@
1
+ require 'reqres_rspec'
2
+
3
+ module ReqresRspec
4
+ module Collector
5
+ # collects spec data for further processing
6
+ def Collector.collect(spec, request, response)
7
+ record = {
8
+ title: 'title',
9
+ }
10
+
11
+ ReqresRspec.records << record
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module ReqresRspec
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'reqres_rspec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "reqres_rspec"
8
+ spec.version = ReqresRspec::VERSION
9
+ spec.authors = ["rilian"]
10
+ spec.email = ["dmitriyis@gmail.com"]
11
+ spec.description = %q{Generates API documentation in PDF, HTML, JSON, YAML format for integration tests written with RSpec}
12
+ spec.summary = %q{Generates API documentation in PDF, HTML, JSON, YAML format for integration tests written with RSpec}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reqres_rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - rilian
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Generates API documentation in PDF, HTML, JSON, YAML format for integration
42
+ tests written with RSpec
43
+ email:
44
+ - dmitriyis@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/reqres_rspec.rb
55
+ - lib/reqres_rspec/collector.rb
56
+ - lib/reqres_rspec/version.rb
57
+ - reqres_rspec.gemspec
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.0.6
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Generates API documentation in PDF, HTML, JSON, YAML format for integration
82
+ tests written with RSpec
83
+ test_files: []