reqres_rspec 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reqres_rspec/collector.rb +6 -3
- data/lib/reqres_rspec/version.rb +1 -1
- data/lib/reqres_rspec/writers/templates/spec.erb +16 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eedf8ddbdf7dc74958a6618ebbcfec0fdba263e
|
4
|
+
data.tar.gz: 172ed7b0b2c315235286f1d9e0636066c8effa55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 683e5df65d3399958a7f9ecfe535cdbff840195742bb5da89c6aacd250796c92ab493e8adfa8ee3bb162a2cedfe9745c74c6aa10e810cdfb1c0005f644628dcd
|
7
|
+
data.tar.gz: 811c33027e5537acad6e3d773a2abdd940dd7d7201e5d005c2c095963651c5f2ef026d2fefeaa10f9164e1c7c8617e20e492c976ae2ec609456ff571153f0fac
|
@@ -8,8 +8,11 @@ module ReqresRspec
|
|
8
8
|
|
9
9
|
# Param types
|
10
10
|
# NOTE: make sure sub-strings go at the end
|
11
|
-
PARAM_TYPES = ['Boolean', '
|
12
|
-
'Array of Integer', 'Array of String', 'Array', 'Integer']
|
11
|
+
PARAM_TYPES = ['Boolean', 'Text', 'Float', 'DateTime', 'Date', 'File',
|
12
|
+
'Array of Integer', 'Array of String', 'Array', 'Integer', 'String']
|
13
|
+
|
14
|
+
# Exclude replacement in symbolized path
|
15
|
+
EXCLUDE_PATH_SYMBOLS = %w[limit offset format description]
|
13
16
|
|
14
17
|
# response headers contain many unnecessary information,
|
15
18
|
# everything from this list will be stripped
|
@@ -141,7 +144,7 @@ module ReqresRspec
|
|
141
144
|
each do |key, value|
|
142
145
|
if value.is_a? String
|
143
146
|
index = request_path.index(value)
|
144
|
-
if index && index >= 0
|
147
|
+
if index && index >= 0 && !EXCLUDE_PATH_SYMBOLS.include?(key)
|
145
148
|
request_path = request_path.sub(value, ":#{key}")
|
146
149
|
end
|
147
150
|
end
|
data/lib/reqres_rspec/version.rb
CHANGED
@@ -232,18 +232,23 @@
|
|
232
232
|
|
233
233
|
<% if @record[:response][:body].present? %>
|
234
234
|
<h5>Body</h5>
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
235
|
+
|
236
|
+
<% if (@record[:response][:headers]['Content-Type'] == 'application/pdf' rescue true) %>
|
237
|
+
<code>PDF document</code>
|
238
|
+
<% else %>
|
239
|
+
<% lines = begin
|
240
|
+
JSON.pretty_generate(
|
241
|
+
JSON.parse(
|
242
|
+
@record[:response][:body]
|
243
|
+
)
|
239
244
|
)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
245
|
+
rescue
|
246
|
+
@record[:response][:body]
|
247
|
+
end %>
|
248
|
+
<code>
|
249
|
+
<%= CodeRay.scan(lines, :json).div(line_numbers: :table) %>
|
250
|
+
</code>
|
251
|
+
<% end %>
|
247
252
|
<% end %>
|
248
253
|
</div>
|
249
254
|
</body>
|