rspec-apidoc 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec/apidoc/static/template.html.erb +5 -1
- data/lib/rspec/apidoc.rb +12 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdcc283a659667529475a9c1836398a5ad092018a484ac60a746994a35924759
|
4
|
+
data.tar.gz: c637fccb0640b1db43582d36f7f4b0889df8017e6bbcfb56506a4d8085b7328a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b550af654071e60b390866d9dd99e6484288cc7013e5a43b1d6e21cb3ac6d7c82f02316daf7500b032fe81cbe9b5859a70207a6b7d762bd6bc54653fdeb8592
|
7
|
+
data.tar.gz: 1818afff93418cba9c72083b565ac73868187f87ef578e8d8509a41990e025ab6d8647967773c0b786ad52d8fad64cef2cb3f73704fabf81fc8aac85739879d3
|
@@ -90,9 +90,13 @@
|
|
90
90
|
</div>
|
91
91
|
|
92
92
|
<% examples.each do |controller, items| %>
|
93
|
-
<% items.sort.
|
93
|
+
<% items.sort.each_with_index do |(action, action_items), mindex| %>
|
94
94
|
<% action_items.each_with_index do |item, index| %>
|
95
95
|
<div class="example">
|
96
|
+
<% if mindex == 0 %>
|
97
|
+
<%= item[:controller_comment] %>
|
98
|
+
<% end %>
|
99
|
+
|
96
100
|
<% if index == 0 %>
|
97
101
|
<div class="example-doc" id="<%= controller %>-<%= action %>">
|
98
102
|
<%= item[:action_comment] || ( item[:method] + ' ' + controller ) %>
|
data/lib/rspec/apidoc.rb
CHANGED
@@ -82,15 +82,21 @@ module RSpec
|
|
82
82
|
response_body = parse_json_safely(spec.response.body)
|
83
83
|
|
84
84
|
if spec.request.controller_instance
|
85
|
-
|
86
|
-
|
87
|
-
).comment
|
85
|
+
action_name = spec.request.controller_instance.action_name
|
86
|
+
action_method = spec.request.controller_instance.method(action_name)
|
88
87
|
# Remove any `@param` or `@return` lines
|
89
|
-
action_comment =
|
88
|
+
action_comment = \
|
89
|
+
action_method.comment.gsub('# ', '').gsub(/@.*$/, '').strip
|
90
90
|
controller_class = spec.request.controller_class
|
91
|
-
|
91
|
+
controller_comment = nil
|
92
|
+
|
93
|
+
if action_method.respond_to?(:class_comment)
|
94
|
+
controller_comment = \
|
95
|
+
action_method.class_comment.gsub('# ', '').gsub(/@.*$/, '').strip
|
96
|
+
end
|
92
97
|
else
|
93
98
|
action_comment = nil
|
99
|
+
controller_comment = nil
|
94
100
|
controller_class = spec.request.path
|
95
101
|
action_name = spec.request.method
|
96
102
|
end
|
@@ -99,6 +105,7 @@ module RSpec
|
|
99
105
|
description: example.metadata[:full_description],
|
100
106
|
|
101
107
|
controller_class: controller_class,
|
108
|
+
controller_comment: controller_comment,
|
102
109
|
action_name: action_name,
|
103
110
|
action_comment: action_comment,
|
104
111
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-apidoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|