rspec-apidoc 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdcc283a659667529475a9c1836398a5ad092018a484ac60a746994a35924759
4
- data.tar.gz: c637fccb0640b1db43582d36f7f4b0889df8017e6bbcfb56506a4d8085b7328a
3
+ metadata.gz: a6040f8561d338dbd272beab483b66dc6cece9cb9eb297d1ad2e216bd77472bd
4
+ data.tar.gz: b1e345058d1989feb9ed811109e49a63c133687a32674a1d28993be59d1c42d1
5
5
  SHA512:
6
- metadata.gz: 0b550af654071e60b390866d9dd99e6484288cc7013e5a43b1d6e21cb3ac6d7c82f02316daf7500b032fe81cbe9b5859a70207a6b7d762bd6bc54653fdeb8592
7
- data.tar.gz: 1818afff93418cba9c72083b565ac73868187f87ef578e8d8509a41990e025ab6d8647967773c0b786ad52d8fad64cef2cb3f73704fabf81fc8aac85739879d3
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
  @- &lt;&lt; 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
  &lt; Content-Type: <%= item[:response_content_type] %>
124
128
  &lt; 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('# ', '').gsub(/@.*$/, '').strip
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
- action_method.class_comment.gsub('# ', '').gsub(/@.*$/, '').strip
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-apidoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Suscov