-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec.handlebars
65 lines (54 loc) · 1.42 KB
/
spec.handlebars
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{{#if spec_description}}
it '{{{spec_description}}}' do
{{else}}
it 'should {{{spec_name}}}' do
{{/if}}
{{#if headers.has_headers}}
{{#headers.header_list}}
header '{{{header_name}}}', "{{{header_value}}}"
{{/headers.header_list}}
{{/if}}
{{! ----- }}
{{#body.has_raw_body}}
payload = "{{{body.raw_body}}}"
{{/body.has_raw_body}}
{{! ----- }}
{{#body.has_long_body}}
payload = 'set your body string'
{{/body.has_long_body}}
{{! ----- }}
{{#body.has_url_encoded_body}}
payload = {
{{#body.url_encoded_body}}
"{{{name}}}" => "{{{value}}}",
{{/body.url_encoded_body}}
}
{{/body.has_url_encoded_body}}
{{! ----- }}
{{#if body.has_multipart_body}}
payload = <<MULTI
{{#body.multipart_body}}
"{{{name}}}" => "{{{value}}}",
{{/body.multipart_body}}
MULTI
{{else}}
{{#if body.has_multipart_body_pre}}
payload = Rack::Test::UploadedFile.new(file, 'image/[file]')
{{/if}}
{{/if}}
{{! ----- }}
{{#body.has_json_body}}
payload = {{{body.json_body_object}}}
{{/body.has_json_body}}
{{#if body}}
{{{request_method}}} "{{{path}}}", payload
{{else}}
{{{request_method}}} "{{{path}}}"
{{/if}}
body = JSON.parse(last_response.body)
{{#each response_body}}
body['{{@key}}']{{{cast_item_with_action this @key}}}
{{/each}}
{{#if response_body}}
{{/if}}
end