|
19 | 19 | expect(subject.route_setting(:description)).to eq(options.merge(description: desc_text)) |
20 | 20 | end |
21 | 21 |
|
22 | | - it 'can be set with a block' do |
23 | | - expected_options = { |
24 | | - summary: 'summary', |
25 | | - description: 'The description', |
26 | | - detail: 'more details', |
27 | | - params: { first: :param }, |
28 | | - entity: Object, |
29 | | - default: { code: 400, message: 'Invalid' }, |
30 | | - http_codes: [[401, 'Unauthorized', 'Entities::Error']], |
31 | | - named: 'My named route', |
32 | | - body_name: 'My body name', |
33 | | - headers: [ |
34 | | - XAuthToken: { |
35 | | - description: 'Valdates your identity', |
36 | | - required: true |
37 | | - }, |
38 | | - XOptionalHeader: { |
39 | | - description: 'Not really needed', |
40 | | - required: false |
41 | | - } |
42 | | - ], |
43 | | - hidden: false, |
44 | | - deprecated: false, |
45 | | - is_array: true, |
46 | | - nickname: 'nickname', |
47 | | - produces: %w[array of mime_types], |
48 | | - consumes: %w[array of mime_types], |
49 | | - tags: %w[tag1 tag2], |
50 | | - security: %w[array of security schemes] |
51 | | - } |
52 | | - |
53 | | - subject.desc 'The description' do |
54 | | - summary 'summary' |
55 | | - detail 'more details' |
56 | | - params(first: :param) |
57 | | - success Object |
58 | | - default code: 400, message: 'Invalid' |
59 | | - failure [[401, 'Unauthorized', 'Entities::Error']] |
60 | | - named 'My named route' |
61 | | - body_name 'My body name' |
62 | | - headers [ |
63 | | - XAuthToken: { |
64 | | - description: 'Valdates your identity', |
65 | | - required: true |
66 | | - }, |
67 | | - XOptionalHeader: { |
68 | | - description: 'Not really needed', |
69 | | - required: false |
70 | | - } |
71 | | - ] |
72 | | - hidden false |
73 | | - deprecated false |
74 | | - is_array true |
75 | | - nickname 'nickname' |
76 | | - produces %w[array of mime_types] |
77 | | - consumes %w[array of mime_types] |
78 | | - tags %w[tag1 tag2] |
79 | | - security %w[array of security schemes] |
| 22 | + context 'when a block is passed' do |
| 23 | + let(:expected_options) do |
| 24 | + { |
| 25 | + summary: 'summary', |
| 26 | + description: 'The description', |
| 27 | + detail: 'more details', |
| 28 | + params: { first: :param }, |
| 29 | + entity: Object, |
| 30 | + default: { code: 400, message: 'Invalid' }, |
| 31 | + http_codes: [[401, 'Unauthorized', 'Entities::Error']], |
| 32 | + named: 'My named route', |
| 33 | + body_name: 'My body name', |
| 34 | + headers: [ |
| 35 | + { |
| 36 | + XAuthToken: { |
| 37 | + description: 'Valdates your identity', |
| 38 | + required: true |
| 39 | + }, |
| 40 | + XOptionalHeader: { |
| 41 | + description: 'Not really needed', |
| 42 | + required: false |
| 43 | + } |
| 44 | + } |
| 45 | + ], |
| 46 | + hidden: false, |
| 47 | + deprecated: false, |
| 48 | + is_array: true, |
| 49 | + nickname: 'nickname', |
| 50 | + produces: %w[array of mime_types], |
| 51 | + consumes: %w[array of mime_types], |
| 52 | + tags: %w[tag1 tag2], |
| 53 | + security: %w[array of security schemes] |
| 54 | + } |
80 | 55 | end |
81 | 56 |
|
82 | | - expect(subject.namespace_setting(:description)).to eq(expected_options) |
83 | | - expect(subject.route_setting(:description)).to eq(expected_options) |
| 57 | + it 'can be set with a block' do |
| 58 | + subject.desc 'The description' do |
| 59 | + summary 'summary' |
| 60 | + detail 'more details' |
| 61 | + params(first: :param) |
| 62 | + success Object |
| 63 | + default code: 400, message: 'Invalid' |
| 64 | + failure [[401, 'Unauthorized', 'Entities::Error']] |
| 65 | + named 'My named route' |
| 66 | + body_name 'My body name' |
| 67 | + headers [ |
| 68 | + { |
| 69 | + XAuthToken: { |
| 70 | + description: 'Valdates your identity', |
| 71 | + required: true |
| 72 | + }, |
| 73 | + XOptionalHeader: { |
| 74 | + description: 'Not really needed', |
| 75 | + required: false |
| 76 | + } |
| 77 | + } |
| 78 | + ] |
| 79 | + hidden false |
| 80 | + deprecated false |
| 81 | + is_array true |
| 82 | + nickname 'nickname' |
| 83 | + produces %w[array of mime_types] |
| 84 | + consumes %w[array of mime_types] |
| 85 | + tags %w[tag1 tag2] |
| 86 | + security %w[array of security schemes] |
| 87 | + end |
| 88 | + |
| 89 | + expect(subject.namespace_setting(:description)).to eq(expected_options) |
| 90 | + expect(subject.route_setting(:description)).to eq(expected_options) |
| 91 | + end |
84 | 92 | end |
85 | 93 | end |
86 | 94 | end |
0 commit comments