rspec_api_documentation 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'rspec/core/formatters/
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
2
|
|
3
3
|
module RspecApiDocumentation
|
4
|
-
class ApiFormatter < RSpec::Core::Formatters::
|
4
|
+
class ApiFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
5
5
|
def initialize(output)
|
6
6
|
super
|
7
7
|
|
@@ -109,6 +109,15 @@ module RspecApiDocumentation
|
|
109
109
|
client.send(method, path_or_query, params_or_body)
|
110
110
|
end
|
111
111
|
|
112
|
+
def no_doc(&block)
|
113
|
+
requests = example.metadata[:requests]
|
114
|
+
example.metadata[:requests] = []
|
115
|
+
|
116
|
+
instance_eval &block
|
117
|
+
|
118
|
+
example.metadata[:requests] = requests
|
119
|
+
end
|
120
|
+
|
112
121
|
def query_string
|
113
122
|
query = params.to_a.map do |param|
|
114
123
|
param.map! { |a| CGI.escape(a.to_s) }
|
@@ -199,7 +208,7 @@ def self.resource(*args, &block)
|
|
199
208
|
options = if args.last.is_a?(Hash) then args.pop else {} end
|
200
209
|
options[:api_docs_dsl] = true
|
201
210
|
options[:resource_name] = args.first
|
202
|
-
options[:document]
|
211
|
+
options[:document] ||= :all
|
203
212
|
args.push(options)
|
204
213
|
describe(*args, &block)
|
205
214
|
end
|
@@ -48,7 +48,8 @@ module RspecApiDocumentation
|
|
48
48
|
:examples => section[:examples].map { |example|
|
49
49
|
{
|
50
50
|
:description => example.description,
|
51
|
-
:link => "#{example.dirname}/#{example.filename}"
|
51
|
+
:link => "#{example.dirname}/#{example.filename}",
|
52
|
+
:groups => example.metadata[:document]
|
52
53
|
}
|
53
54
|
}
|
54
55
|
)
|
@@ -79,7 +79,11 @@ module RspecApiDocumentation
|
|
79
79
|
request_metadata[:request_query_parameters] = format_query_hash(last_query_hash)
|
80
80
|
request_metadata[:response_status] = last_response.status
|
81
81
|
request_metadata[:response_status_text] = Rack::Utils::HTTP_STATUS_CODES[last_response.status]
|
82
|
-
|
82
|
+
if is_json?(request_body)
|
83
|
+
request_metadata[:response_body] = prettify_json(last_response.body)
|
84
|
+
else
|
85
|
+
request_metadata[:response_body] = last_response.body
|
86
|
+
end
|
83
87
|
request_metadata[:response_headers] = format_headers(last_response.headers)
|
84
88
|
request_metadata[:curl] = Curl.new(method.to_s, action, request_body, last_headers)
|
85
89
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_api_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-03-08 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: &
|
18
|
+
requirement: &70208656642920 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 2.6.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70208656642920
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
|
-
requirement: &
|
29
|
+
requirement: &70208656642360 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 3.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70208656642360
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: i18n
|
40
|
-
requirement: &
|
40
|
+
requirement: &70208656641780 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: 0.1.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70208656641780
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rack-test
|
51
|
-
requirement: &
|
51
|
+
requirement: &70208656641040 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ! '>='
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: 0.5.5
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70208656641040
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: mustache
|
62
|
-
requirement: &
|
62
|
+
requirement: &70208656640280 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ! '>='
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: 0.99.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70208656640280
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: webmock
|
73
|
-
requirement: &
|
73
|
+
requirement: &70208656639500 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ! '>='
|
@@ -78,10 +78,10 @@ dependencies:
|
|
78
78
|
version: 1.7.0
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70208656639500
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: json
|
84
|
-
requirement: &
|
84
|
+
requirement: &70208656638740 !ruby/object:Gem::Requirement
|
85
85
|
none: false
|
86
86
|
requirements:
|
87
87
|
- - ! '>='
|
@@ -89,10 +89,10 @@ dependencies:
|
|
89
89
|
version: 1.4.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
|
-
version_requirements: *
|
92
|
+
version_requirements: *70208656638740
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: fakefs
|
95
|
-
requirement: &
|
95
|
+
requirement: &70208656637980 !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
98
98
|
- - ! '>='
|
@@ -100,10 +100,10 @@ dependencies:
|
|
100
100
|
version: '0'
|
101
101
|
type: :development
|
102
102
|
prerelease: false
|
103
|
-
version_requirements: *
|
103
|
+
version_requirements: *70208656637980
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: sinatra
|
106
|
-
requirement: &
|
106
|
+
requirement: &70208656637420 !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|
109
109
|
- - ! '>='
|
@@ -111,7 +111,40 @@ dependencies:
|
|
111
111
|
version: '0'
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
|
-
version_requirements: *
|
114
|
+
version_requirements: *70208656637420
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: builder
|
117
|
+
requirement: &70208656636980 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: *70208656636980
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: aruba
|
128
|
+
requirement: &70208656636420 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: *70208656636420
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: capybara
|
139
|
+
requirement: &70208656635940 !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: *70208656635940
|
115
148
|
description: Generate API docs from your test suite
|
116
149
|
email:
|
117
150
|
- chris@smartlogicsolutions.com
|