rspec-apidoc 0.1.1 → 0.1.2
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 +9 -0
- data/lib/rspec/apidoc.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6040f8561d338dbd272beab483b66dc6cece9cb9eb297d1ad2e216bd77472bd
|
4
|
+
data.tar.gz: b1e345058d1989feb9ed811109e49a63c133687a32674a1d28993be59d1c42d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d1dbb5b800742ef654a8c94f72ab995354dc0b3bc833dfed9c4727c62fb605c8a140f02010f8bd80d22ea0773524642bd6f8768f81032dba6bfd0e7a49afd6b
|
7
|
+
data.tar.gz: 401f81d86c511f435970dbea258d06ad8fa7f23ecd971fbc2f585ad25f04acbf5a7489ca1f25b3ee0d1ac86717559c5e061fe58de5993562495488eacfa8a578
|
@@ -112,7 +112,11 @@ $ curl '<%= host %><%= item[:path] %><%= ('?' + item[:query]) if item[:query] !=
|
|
112
112
|
-X <%= item[:method] %> \
|
113
113
|
-H 'Content-Type: <%= item[:content_type] %>' <% if item[:request_body] != '' %> \
|
114
114
|
@- << EOF
|
115
|
+
<% if item[:request_body].is_a?(String) %>
|
116
|
+
<%=h item[:request_body] %>
|
117
|
+
<% else %>
|
115
118
|
<%=h JSON.pretty_generate(item[:request_body]) %>
|
119
|
+
<% end %>
|
116
120
|
EOF
|
117
121
|
<% end %>
|
118
122
|
</pre>
|
@@ -122,7 +126,12 @@ EOF
|
|
122
126
|
<pre>
|
123
127
|
< Content-Type: <%= item[:response_content_type] %>
|
124
128
|
< Status: <%= item[:status] %>
|
129
|
+
|
130
|
+
<% if item[:response_body].is_a?(String) %>
|
131
|
+
<%=h item[:response_body] %>
|
132
|
+
<% else %>
|
125
133
|
<%=h JSON.pretty_generate(item[:response_body]) %>
|
134
|
+
<% end %>
|
126
135
|
</pre>
|
127
136
|
</div>
|
128
137
|
</div>
|
data/lib/rspec/apidoc.rb
CHANGED
@@ -86,13 +86,14 @@ module RSpec
|
|
86
86
|
action_method = spec.request.controller_instance.method(action_name)
|
87
87
|
# Remove any `@param` or `@return` lines
|
88
88
|
action_comment = \
|
89
|
-
action_method.comment.gsub(
|
89
|
+
action_method.comment.gsub(/^#\s?/, '').strip.gsub(/^@.*$/, '').strip
|
90
90
|
controller_class = spec.request.controller_class
|
91
91
|
controller_comment = nil
|
92
92
|
|
93
93
|
if action_method.respond_to?(:class_comment)
|
94
|
-
controller_comment =
|
95
|
-
|
94
|
+
controller_comment = action_method.class_comment.gsub(
|
95
|
+
/.*frozen_string_literal:.*/, ''
|
96
|
+
).strip.gsub(/^#\s?/, '').strip.gsub(/^@.*$/, '')
|
96
97
|
end
|
97
98
|
else
|
98
99
|
action_comment = nil
|