serverspec-extra-types 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rspec +0 -0
  4. data/.rubocop.yml +0 -0
  5. data/.travis.yml +0 -0
  6. data/CODE_OF_CONDUCT.md +0 -0
  7. data/Gemfile +0 -0
  8. data/LICENSE.txt +0 -0
  9. data/README.md +657 -4
  10. data/Rakefile +0 -0
  11. data/bin/consul_gen.rb +115 -0
  12. data/bin/http_doc_gem.rb +67 -0
  13. data/http_matchers.md +1771 -0
  14. data/lib/serverspec_extra_types.rb +0 -0
  15. data/lib/serverspec_extra_types/helpers/properties.rb +0 -0
  16. data/lib/serverspec_extra_types/matchers.rb +4 -0
  17. data/lib/serverspec_extra_types/matchers/allowed_to_run_anything.rb +38 -0
  18. data/lib/serverspec_extra_types/matchers/allowed_to_run_command.rb +40 -0
  19. data/lib/serverspec_extra_types/matchers/be_a_manager_node.rb +0 -0
  20. data/lib/serverspec_extra_types/matchers/be_a_worker_node.rb +0 -0
  21. data/lib/serverspec_extra_types/matchers/be_active.rb +0 -0
  22. data/lib/serverspec_extra_types/matchers/configure_queue.rb +0 -0
  23. data/lib/serverspec_extra_types/matchers/have_count.rb +0 -0
  24. data/lib/serverspec_extra_types/matchers/have_domain_name.rb +0 -0
  25. data/lib/serverspec_extra_types/matchers/have_engine_version.rb +0 -0
  26. data/lib/serverspec_extra_types/matchers/have_environment_variable.rb +0 -0
  27. data/lib/serverspec_extra_types/matchers/have_ha_mode.rb +0 -0
  28. data/lib/serverspec_extra_types/matchers/have_ha_nodes.rb +0 -0
  29. data/lib/serverspec_extra_types/matchers/have_ha_sync_mode.rb +0 -0
  30. data/lib/serverspec_extra_types/matchers/have_host.rb +0 -0
  31. data/lib/serverspec_extra_types/matchers/have_hostname.rb +0 -0
  32. data/lib/serverspec_extra_types/matchers/have_image.rb +4 -0
  33. data/lib/serverspec_extra_types/matchers/have_image_sha.rb +0 -0
  34. data/lib/serverspec_extra_types/matchers/have_label.rb +0 -0
  35. data/lib/serverspec_extra_types/matchers/have_mount.rb +0 -0
  36. data/lib/serverspec_extra_types/matchers/have_network.rb +0 -0
  37. data/lib/serverspec_extra_types/matchers/have_placement_constraint.rb +0 -0
  38. data/lib/serverspec_extra_types/matchers/have_replica_count.rb +0 -0
  39. data/lib/serverspec_extra_types/matchers/have_restart_limit.rb +0 -0
  40. data/lib/serverspec_extra_types/matchers/have_restart_policy.rb +0 -0
  41. data/lib/serverspec_extra_types/matchers/have_user.rb +0 -0
  42. data/lib/serverspec_extra_types/matchers/have_vhost.rb +0 -0
  43. data/lib/serverspec_extra_types/matchers/http_1xx.rb +0 -0
  44. data/lib/serverspec_extra_types/matchers/http_2xx.rb +0 -0
  45. data/lib/serverspec_extra_types/matchers/http_3xx.rb +0 -0
  46. data/lib/serverspec_extra_types/matchers/http_4xx.rb +0 -0
  47. data/lib/serverspec_extra_types/matchers/http_5xx.rb +0 -0
  48. data/lib/serverspec_extra_types/matchers/include_regex.rb +0 -0
  49. data/lib/serverspec_extra_types/matchers/map_port.rb +0 -0
  50. data/lib/serverspec_extra_types/matchers/mirror_all.rb +0 -0
  51. data/lib/serverspec_extra_types/matchers/publish_all_ports.rb +0 -0
  52. data/lib/serverspec_extra_types/matchers/read_from_queue.rb +0 -0
  53. data/lib/serverspec_extra_types/matchers/url_matchers.rb +0 -0
  54. data/lib/serverspec_extra_types/matchers/write_to_queue.rb +0 -0
  55. data/lib/serverspec_extra_types/types.rb +2 -1
  56. data/lib/serverspec_extra_types/types/api_base.rb +10 -1
  57. data/lib/serverspec_extra_types/types/consul_base.rb +6 -2
  58. data/lib/serverspec_extra_types/types/consul_node.rb +21 -1
  59. data/lib/serverspec_extra_types/types/consul_node_list.rb +1 -1
  60. data/lib/serverspec_extra_types/types/consul_service.rb +188 -1
  61. data/lib/serverspec_extra_types/types/consul_service_list.rb +0 -0
  62. data/lib/serverspec_extra_types/types/curl.rb +5 -1
  63. data/lib/serverspec_extra_types/types/docker_config.rb +55 -0
  64. data/lib/serverspec_extra_types/types/docker_container.rb +0 -0
  65. data/lib/serverspec_extra_types/types/docker_network.rb +74 -1
  66. data/lib/serverspec_extra_types/types/docker_node.rb +12 -0
  67. data/lib/serverspec_extra_types/types/docker_secret.rb +56 -0
  68. data/lib/serverspec_extra_types/types/docker_service.rb +0 -0
  69. data/lib/serverspec_extra_types/types/rabbitmq_base.rb +7 -1
  70. data/lib/serverspec_extra_types/types/rabbitmq_node_list.rb +5 -1
  71. data/lib/serverspec_extra_types/types/rabbitmq_user_permission.rb +0 -0
  72. data/lib/serverspec_extra_types/types/rabbitmq_vhost_list.rb +4 -0
  73. data/lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb +0 -0
  74. data/lib/serverspec_extra_types/types/sudo_user.rb +90 -0
  75. data/lib/serverspec_extra_types/version.rb +1 -1
  76. data/properties.yml +45 -7
  77. data/serverspec-extra-types.gemspec +4 -1
  78. metadata +55 -5
data/Rakefile CHANGED
File without changes
data/bin/consul_gen.rb ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rest-client'
4
+ require 'docker'
5
+ require 'multi_json'
6
+ require 'yaml'
7
+
8
+ class String
9
+ def underscore
10
+ self.gsub(/::/, '/').
11
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
12
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
13
+ tr("-", "_").
14
+ downcase
15
+ end
16
+ end
17
+
18
+ def quote(data, type)
19
+ if type == 'String'
20
+ "'#{data}'"
21
+ else
22
+ "#{data}"
23
+ end
24
+ end
25
+
26
+ docker_container = Docker::Container.create(
27
+ 'Image' => 'consul:latest',
28
+ 'HostConfig' => {
29
+ 'PortBindings' => {
30
+ '8500/tcp' => [{ 'HostPort' => '8500' }]
31
+ }
32
+ },
33
+ 'Hostname' => 'consul'
34
+ )
35
+ docker_container.start
36
+ container_id = docker_container.id[0..10]
37
+ sleep(10)
38
+
39
+ FileUtils.mkpath './tmp' unless Dir.exists?('./tmp')
40
+
41
+
42
+
43
+ def generate_methods(type_name, data)
44
+ puts data.to_yaml
45
+ File.open("./tmp/#{type_name}_methods", 'w') do |file|
46
+ data.keys.each do |key|
47
+ type = data[key].class
48
+ file.write "# Key Type: #{type}\n"
49
+ file.write "def #{key.underscore}\n"
50
+ file.write " inspection['#{key}']\n"
51
+ file.write "end\n\n"
52
+ if type != 'Hash' || type != 'Array'
53
+ file.write "def has_#{key.underscore}?(#{key.underscore})\n"
54
+ file.write " self.#{key.underscore} == #{key.underscore}\n"
55
+ file.write "end\n\n"
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ def generate_tests(type_name, data, type_params)
62
+ File.open("./tmp/#{type_name}_tests", 'w') do |file|
63
+ file.write "describe #{type_name}(#{type_params ? quote(type_params, type_params.class.to_s) : ''}) do\n"
64
+ data.keys.each do |key|
65
+ type = data[key].class
66
+ file.write " it { should have_#{key.underscore}(#{quote(data[key], type.to_s)}) }\n"
67
+ end
68
+ file.write "end\n\n"
69
+ end
70
+ end
71
+
72
+ def generate_docs(type_name, data, type_params)
73
+ File.open("./tmp/#{type_name}_docs", 'w') do |file|
74
+
75
+ data.keys.each do |key|
76
+ type = data[key].class
77
+ file.write "#### have_#{key.underscore}\n"
78
+ file.write "```ruby\n"
79
+ file.write "describe #{type_name}(#{type_params ? quote(type_params, type_params.class.to_s) : ''}) do\n"
80
+ file.write " it { should have_#{key.underscore}(#{quote(data[key], type.to_s)}) }\n"
81
+ file.write "end\n"
82
+ file.write "```\n\n"
83
+ end
84
+ file.write "end\n\n"
85
+ end
86
+ end
87
+
88
+ types = [{
89
+ name: 'consul_service',
90
+ url: 'http://localhost:8500/v1/catalog/service/consul',
91
+ type_params: 'consul',
92
+ },{
93
+ name: 'consul_node',
94
+ url: 'http://localhost:8500/v1/catalog/node/consul',
95
+ type_params: 'consul'
96
+ }]
97
+
98
+
99
+ types.each do |type|
100
+ resp = RestClient.get type[:url]
101
+ out = MultiJson.load(resp.body)
102
+ if out.is_a?(Array)
103
+ data = out[0]
104
+ else
105
+ data = out
106
+ end
107
+ generate_methods(type[:name], data)
108
+ generate_docs(type[:name], data, type[:type_params])
109
+ generate_tests(type[:name], data, type[:type_params])
110
+ end
111
+
112
+ docker_container.stop
113
+ docker_container.delete
114
+
115
+
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+
4
+ def example(matcher)
5
+ <<~HEREDOC
6
+ ##### #{matcher}
7
+ ```ruby
8
+ describe curl("https://example.org") do
9
+ it { should #{matcher} }
10
+ end
11
+ ```
12
+
13
+ HEREDOC
14
+ end
15
+
16
+ def grep_matchers(file)
17
+ lines = []
18
+ File.foreach(file) do |line|
19
+ match = /Matchers\.define :([a-zA-Z0-9_]*) do/.match(line)
20
+ next unless match
21
+ lines << match[1]
22
+ end
23
+ lines
24
+ end
25
+
26
+ def do_http_matcher_docs(num, file)
27
+ file.write "### HTTP_#{num}xx matchers <a name=\"http_#{num}xxx\"></a>\n\n"
28
+ grep_matchers("lib/serverspec_extra_types/matchers/http_#{num}xx.rb").each do |matcher|
29
+ file.write example(matcher)
30
+ end
31
+ end
32
+
33
+
34
+ def do_tests(errcode, matcher, file)
35
+ file.write " describe curl('http://localhost:18754/#{errcode}') do\n"
36
+ file.write " it { should #{matcher} }\n"
37
+ file.write " end\n\n"
38
+ end
39
+
40
+ File.open('http_matchers.md', 'w') do |file|
41
+ file.write "## HTTP matchers\n\n"
42
+ (1..5).to_a.each do |num|
43
+ file.write "[HTTP_#{num}XX](#http_#{num}xx) | "
44
+ end
45
+ file.write("\n")
46
+ (1..5).to_a.each do |num|
47
+ do_http_matcher_docs(num,file)
48
+ end
49
+ end
50
+
51
+ (1..5).to_a.each do |num|
52
+ File.open("spec/shared/http_#{num}xx.rb", 'w') do |file|
53
+ errcode = "#{num}00"
54
+ file.write "shared_examples 'HTTP::#{num}XX' do\n"
55
+ grep_matchers("lib/serverspec_extra_types/matchers/http_#{num}xx.rb").each do |matcher|
56
+ match = /_([0-9]{3})$/.match(matcher)
57
+ if match
58
+ file.write " end\n" if match[1] != errcode
59
+ errcode = match[1]
60
+ file.write " describe curl('http://localhost:18754/#{errcode}') do\n"
61
+ end
62
+ file.write " it { should #{matcher} }\n"
63
+ end
64
+ file.write " end\n"
65
+ file.write "end\n\n"
66
+ end
67
+ end
data/http_matchers.md ADDED
@@ -0,0 +1,1771 @@
1
+ ## HTTP matchers
2
+ [HTTP_1XX](#http_1xx) | [HTTP_2XX](#http_2xx) | [HTTP_3XX](#http_3xx) | [HTTP_4XX](#http_4xx) | [HTTP_5XX](#http_5xx) |
3
+ ### HTTP_1xx matchers <a name="http_1xxx"></a>
4
+ ##### respond_with_100
5
+ ```ruby
6
+ describe curl("https://example.org") do
7
+ it { should respond_with_100 }
8
+ end
9
+ ```
10
+
11
+ ##### respond_with_CONTINUE
12
+ ```ruby
13
+ describe curl("https://example.org") do
14
+ it { should respond_with_CONTINUE }
15
+ end
16
+ ```
17
+
18
+ ##### respond_with_continue
19
+ ```ruby
20
+ describe curl("https://example.org") do
21
+ it { should respond_with_continue }
22
+ end
23
+ ```
24
+
25
+ ##### be_continue
26
+ ```ruby
27
+ describe curl("https://example.org") do
28
+ it { should be_continue }
29
+ end
30
+ ```
31
+
32
+ ##### respond_with_101
33
+ ```ruby
34
+ describe curl("https://example.org") do
35
+ it { should respond_with_101 }
36
+ end
37
+ ```
38
+
39
+ ##### respond_with_SWITCHING_PROTOCOLS
40
+ ```ruby
41
+ describe curl("https://example.org") do
42
+ it { should respond_with_SWITCHING_PROTOCOLS }
43
+ end
44
+ ```
45
+
46
+ ##### respond_with_switching_protocols
47
+ ```ruby
48
+ describe curl("https://example.org") do
49
+ it { should respond_with_switching_protocols }
50
+ end
51
+ ```
52
+
53
+ ##### be_switching_protocols
54
+ ```ruby
55
+ describe curl("https://example.org") do
56
+ it { should be_switching_protocols }
57
+ end
58
+ ```
59
+
60
+ ##### respond_with_102
61
+ ```ruby
62
+ describe curl("https://example.org") do
63
+ it { should respond_with_102 }
64
+ end
65
+ ```
66
+
67
+ ##### respond_with_PROCESSING
68
+ ```ruby
69
+ describe curl("https://example.org") do
70
+ it { should respond_with_PROCESSING }
71
+ end
72
+ ```
73
+
74
+ ##### respond_with_processing
75
+ ```ruby
76
+ describe curl("https://example.org") do
77
+ it { should respond_with_processing }
78
+ end
79
+ ```
80
+
81
+ ##### be_processing
82
+ ```ruby
83
+ describe curl("https://example.org") do
84
+ it { should be_processing }
85
+ end
86
+ ```
87
+
88
+ ### HTTP_2xx matchers <a name="http_2xxx"></a>
89
+ ##### respond_with_200
90
+ ```ruby
91
+ describe curl("https://example.org") do
92
+ it { should respond_with_200 }
93
+ end
94
+ ```
95
+
96
+ ##### respond_with_OK
97
+ ```ruby
98
+ describe curl("https://example.org") do
99
+ it { should respond_with_OK }
100
+ end
101
+ ```
102
+
103
+ ##### respond_with_ok
104
+ ```ruby
105
+ describe curl("https://example.org") do
106
+ it { should respond_with_ok }
107
+ end
108
+ ```
109
+
110
+ ##### be_ok
111
+ ```ruby
112
+ describe curl("https://example.org") do
113
+ it { should be_ok }
114
+ end
115
+ ```
116
+
117
+ ##### respond_with_201
118
+ ```ruby
119
+ describe curl("https://example.org") do
120
+ it { should respond_with_201 }
121
+ end
122
+ ```
123
+
124
+ ##### respond_with_CREATED
125
+ ```ruby
126
+ describe curl("https://example.org") do
127
+ it { should respond_with_CREATED }
128
+ end
129
+ ```
130
+
131
+ ##### respond_with_created
132
+ ```ruby
133
+ describe curl("https://example.org") do
134
+ it { should respond_with_created }
135
+ end
136
+ ```
137
+
138
+ ##### be_created
139
+ ```ruby
140
+ describe curl("https://example.org") do
141
+ it { should be_created }
142
+ end
143
+ ```
144
+
145
+ ##### respond_with_202
146
+ ```ruby
147
+ describe curl("https://example.org") do
148
+ it { should respond_with_202 }
149
+ end
150
+ ```
151
+
152
+ ##### respond_with_ACCEPTED
153
+ ```ruby
154
+ describe curl("https://example.org") do
155
+ it { should respond_with_ACCEPTED }
156
+ end
157
+ ```
158
+
159
+ ##### respond_with_accepted
160
+ ```ruby
161
+ describe curl("https://example.org") do
162
+ it { should respond_with_accepted }
163
+ end
164
+ ```
165
+
166
+ ##### be_accepted
167
+ ```ruby
168
+ describe curl("https://example.org") do
169
+ it { should be_accepted }
170
+ end
171
+ ```
172
+
173
+ ##### respond_with_203
174
+ ```ruby
175
+ describe curl("https://example.org") do
176
+ it { should respond_with_203 }
177
+ end
178
+ ```
179
+
180
+ ##### respond_with_NON_AUTHORITATIVE_INFORMATION
181
+ ```ruby
182
+ describe curl("https://example.org") do
183
+ it { should respond_with_NON_AUTHORITATIVE_INFORMATION }
184
+ end
185
+ ```
186
+
187
+ ##### respond_with_non_authoritative_information
188
+ ```ruby
189
+ describe curl("https://example.org") do
190
+ it { should respond_with_non_authoritative_information }
191
+ end
192
+ ```
193
+
194
+ ##### be_non_authoritative_information
195
+ ```ruby
196
+ describe curl("https://example.org") do
197
+ it { should be_non_authoritative_information }
198
+ end
199
+ ```
200
+
201
+ ##### respond_with_204
202
+ ```ruby
203
+ describe curl("https://example.org") do
204
+ it { should respond_with_204 }
205
+ end
206
+ ```
207
+
208
+ ##### respond_with_NO_CONTENT
209
+ ```ruby
210
+ describe curl("https://example.org") do
211
+ it { should respond_with_NO_CONTENT }
212
+ end
213
+ ```
214
+
215
+ ##### respond_with_no_content
216
+ ```ruby
217
+ describe curl("https://example.org") do
218
+ it { should respond_with_no_content }
219
+ end
220
+ ```
221
+
222
+ ##### be_no_content
223
+ ```ruby
224
+ describe curl("https://example.org") do
225
+ it { should be_no_content }
226
+ end
227
+ ```
228
+
229
+ ##### respond_with_205
230
+ ```ruby
231
+ describe curl("https://example.org") do
232
+ it { should respond_with_205 }
233
+ end
234
+ ```
235
+
236
+ ##### respond_with_RESET_CONTENT
237
+ ```ruby
238
+ describe curl("https://example.org") do
239
+ it { should respond_with_RESET_CONTENT }
240
+ end
241
+ ```
242
+
243
+ ##### respond_with_reset_content
244
+ ```ruby
245
+ describe curl("https://example.org") do
246
+ it { should respond_with_reset_content }
247
+ end
248
+ ```
249
+
250
+ ##### be_reset_content
251
+ ```ruby
252
+ describe curl("https://example.org") do
253
+ it { should be_reset_content }
254
+ end
255
+ ```
256
+
257
+ ##### respond_with_206
258
+ ```ruby
259
+ describe curl("https://example.org") do
260
+ it { should respond_with_206 }
261
+ end
262
+ ```
263
+
264
+ ##### respond_with_PARTIAL_CONTENT
265
+ ```ruby
266
+ describe curl("https://example.org") do
267
+ it { should respond_with_PARTIAL_CONTENT }
268
+ end
269
+ ```
270
+
271
+ ##### respond_with_partial_content
272
+ ```ruby
273
+ describe curl("https://example.org") do
274
+ it { should respond_with_partial_content }
275
+ end
276
+ ```
277
+
278
+ ##### be_partial_content
279
+ ```ruby
280
+ describe curl("https://example.org") do
281
+ it { should be_partial_content }
282
+ end
283
+ ```
284
+
285
+ ##### respond_with_207
286
+ ```ruby
287
+ describe curl("https://example.org") do
288
+ it { should respond_with_207 }
289
+ end
290
+ ```
291
+
292
+ ##### respond_with_MULTI_STATUS
293
+ ```ruby
294
+ describe curl("https://example.org") do
295
+ it { should respond_with_MULTI_STATUS }
296
+ end
297
+ ```
298
+
299
+ ##### respond_with_multi_status
300
+ ```ruby
301
+ describe curl("https://example.org") do
302
+ it { should respond_with_multi_status }
303
+ end
304
+ ```
305
+
306
+ ##### be_multi_status
307
+ ```ruby
308
+ describe curl("https://example.org") do
309
+ it { should be_multi_status }
310
+ end
311
+ ```
312
+
313
+ ##### respond_with_208
314
+ ```ruby
315
+ describe curl("https://example.org") do
316
+ it { should respond_with_208 }
317
+ end
318
+ ```
319
+
320
+ ##### respond_with_ALREADY_REPORTED
321
+ ```ruby
322
+ describe curl("https://example.org") do
323
+ it { should respond_with_ALREADY_REPORTED }
324
+ end
325
+ ```
326
+
327
+ ##### respond_with_already_reported
328
+ ```ruby
329
+ describe curl("https://example.org") do
330
+ it { should respond_with_already_reported }
331
+ end
332
+ ```
333
+
334
+ ##### be_already_reported
335
+ ```ruby
336
+ describe curl("https://example.org") do
337
+ it { should be_already_reported }
338
+ end
339
+ ```
340
+
341
+ ##### respond_with_226
342
+ ```ruby
343
+ describe curl("https://example.org") do
344
+ it { should respond_with_226 }
345
+ end
346
+ ```
347
+
348
+ ##### respond_with_IM_USED
349
+ ```ruby
350
+ describe curl("https://example.org") do
351
+ it { should respond_with_IM_USED }
352
+ end
353
+ ```
354
+
355
+ ##### respond_with_im_used
356
+ ```ruby
357
+ describe curl("https://example.org") do
358
+ it { should respond_with_im_used }
359
+ end
360
+ ```
361
+
362
+ ##### be_im_used
363
+ ```ruby
364
+ describe curl("https://example.org") do
365
+ it { should be_im_used }
366
+ end
367
+ ```
368
+
369
+ ### HTTP_3xx matchers <a name="http_3xxx"></a>
370
+ ##### respond_with_300
371
+ ```ruby
372
+ describe curl("https://example.org") do
373
+ it { should respond_with_300 }
374
+ end
375
+ ```
376
+
377
+ ##### respond_with_MULTIPLE_CHOICES
378
+ ```ruby
379
+ describe curl("https://example.org") do
380
+ it { should respond_with_MULTIPLE_CHOICES }
381
+ end
382
+ ```
383
+
384
+ ##### respond_with_multiple_choices
385
+ ```ruby
386
+ describe curl("https://example.org") do
387
+ it { should respond_with_multiple_choices }
388
+ end
389
+ ```
390
+
391
+ ##### be_multiple_choices
392
+ ```ruby
393
+ describe curl("https://example.org") do
394
+ it { should be_multiple_choices }
395
+ end
396
+ ```
397
+
398
+ ##### respond_with_301
399
+ ```ruby
400
+ describe curl("https://example.org") do
401
+ it { should respond_with_301 }
402
+ end
403
+ ```
404
+
405
+ ##### respond_with_MOVED_PERMANENTLY
406
+ ```ruby
407
+ describe curl("https://example.org") do
408
+ it { should respond_with_MOVED_PERMANENTLY }
409
+ end
410
+ ```
411
+
412
+ ##### respond_with_moved_permanently
413
+ ```ruby
414
+ describe curl("https://example.org") do
415
+ it { should respond_with_moved_permanently }
416
+ end
417
+ ```
418
+
419
+ ##### be_moved_permanently
420
+ ```ruby
421
+ describe curl("https://example.org") do
422
+ it { should be_moved_permanently }
423
+ end
424
+ ```
425
+
426
+ ##### respond_with_302
427
+ ```ruby
428
+ describe curl("https://example.org") do
429
+ it { should respond_with_302 }
430
+ end
431
+ ```
432
+
433
+ ##### respond_with_FOUND
434
+ ```ruby
435
+ describe curl("https://example.org") do
436
+ it { should respond_with_FOUND }
437
+ end
438
+ ```
439
+
440
+ ##### respond_with_found
441
+ ```ruby
442
+ describe curl("https://example.org") do
443
+ it { should respond_with_found }
444
+ end
445
+ ```
446
+
447
+ ##### be_found
448
+ ```ruby
449
+ describe curl("https://example.org") do
450
+ it { should be_found }
451
+ end
452
+ ```
453
+
454
+ ##### respond_with_303
455
+ ```ruby
456
+ describe curl("https://example.org") do
457
+ it { should respond_with_303 }
458
+ end
459
+ ```
460
+
461
+ ##### respond_with_SEE_OTHER
462
+ ```ruby
463
+ describe curl("https://example.org") do
464
+ it { should respond_with_SEE_OTHER }
465
+ end
466
+ ```
467
+
468
+ ##### respond_with_see_other
469
+ ```ruby
470
+ describe curl("https://example.org") do
471
+ it { should respond_with_see_other }
472
+ end
473
+ ```
474
+
475
+ ##### be_see_other
476
+ ```ruby
477
+ describe curl("https://example.org") do
478
+ it { should be_see_other }
479
+ end
480
+ ```
481
+
482
+ ##### respond_with_304
483
+ ```ruby
484
+ describe curl("https://example.org") do
485
+ it { should respond_with_304 }
486
+ end
487
+ ```
488
+
489
+ ##### respond_with_NOT_MODIFIED
490
+ ```ruby
491
+ describe curl("https://example.org") do
492
+ it { should respond_with_NOT_MODIFIED }
493
+ end
494
+ ```
495
+
496
+ ##### respond_with_not_modified
497
+ ```ruby
498
+ describe curl("https://example.org") do
499
+ it { should respond_with_not_modified }
500
+ end
501
+ ```
502
+
503
+ ##### be_not_modified
504
+ ```ruby
505
+ describe curl("https://example.org") do
506
+ it { should be_not_modified }
507
+ end
508
+ ```
509
+
510
+ ##### respond_with_305
511
+ ```ruby
512
+ describe curl("https://example.org") do
513
+ it { should respond_with_305 }
514
+ end
515
+ ```
516
+
517
+ ##### respond_with_USE_PROXY
518
+ ```ruby
519
+ describe curl("https://example.org") do
520
+ it { should respond_with_USE_PROXY }
521
+ end
522
+ ```
523
+
524
+ ##### respond_with_use_proxy
525
+ ```ruby
526
+ describe curl("https://example.org") do
527
+ it { should respond_with_use_proxy }
528
+ end
529
+ ```
530
+
531
+ ##### be_use_proxy
532
+ ```ruby
533
+ describe curl("https://example.org") do
534
+ it { should be_use_proxy }
535
+ end
536
+ ```
537
+
538
+ ##### respond_with_307
539
+ ```ruby
540
+ describe curl("https://example.org") do
541
+ it { should respond_with_307 }
542
+ end
543
+ ```
544
+
545
+ ##### respond_with_TEMPORARY_REDIRECT
546
+ ```ruby
547
+ describe curl("https://example.org") do
548
+ it { should respond_with_TEMPORARY_REDIRECT }
549
+ end
550
+ ```
551
+
552
+ ##### respond_with_temporary_redirect
553
+ ```ruby
554
+ describe curl("https://example.org") do
555
+ it { should respond_with_temporary_redirect }
556
+ end
557
+ ```
558
+
559
+ ##### be_temporary_redirect
560
+ ```ruby
561
+ describe curl("https://example.org") do
562
+ it { should be_temporary_redirect }
563
+ end
564
+ ```
565
+
566
+ ##### respond_with_308
567
+ ```ruby
568
+ describe curl("https://example.org") do
569
+ it { should respond_with_308 }
570
+ end
571
+ ```
572
+
573
+ ##### respond_with_PERMANENT_REDIRECT
574
+ ```ruby
575
+ describe curl("https://example.org") do
576
+ it { should respond_with_PERMANENT_REDIRECT }
577
+ end
578
+ ```
579
+
580
+ ##### respond_with_permanent_redirect
581
+ ```ruby
582
+ describe curl("https://example.org") do
583
+ it { should respond_with_permanent_redirect }
584
+ end
585
+ ```
586
+
587
+ ##### be_permanent_redirect
588
+ ```ruby
589
+ describe curl("https://example.org") do
590
+ it { should be_permanent_redirect }
591
+ end
592
+ ```
593
+
594
+ ### HTTP_4xx matchers <a name="http_4xxx"></a>
595
+ ##### respond_with_400
596
+ ```ruby
597
+ describe curl("https://example.org") do
598
+ it { should respond_with_400 }
599
+ end
600
+ ```
601
+
602
+ ##### respond_with_BAD_REQUEST
603
+ ```ruby
604
+ describe curl("https://example.org") do
605
+ it { should respond_with_BAD_REQUEST }
606
+ end
607
+ ```
608
+
609
+ ##### respond_with_bad_request
610
+ ```ruby
611
+ describe curl("https://example.org") do
612
+ it { should respond_with_bad_request }
613
+ end
614
+ ```
615
+
616
+ ##### be_bad_request
617
+ ```ruby
618
+ describe curl("https://example.org") do
619
+ it { should be_bad_request }
620
+ end
621
+ ```
622
+
623
+ ##### respond_with_401
624
+ ```ruby
625
+ describe curl("https://example.org") do
626
+ it { should respond_with_401 }
627
+ end
628
+ ```
629
+
630
+ ##### respond_with_UNAUTHORIZED
631
+ ```ruby
632
+ describe curl("https://example.org") do
633
+ it { should respond_with_UNAUTHORIZED }
634
+ end
635
+ ```
636
+
637
+ ##### respond_with_unauthorized
638
+ ```ruby
639
+ describe curl("https://example.org") do
640
+ it { should respond_with_unauthorized }
641
+ end
642
+ ```
643
+
644
+ ##### be_unauthorized
645
+ ```ruby
646
+ describe curl("https://example.org") do
647
+ it { should be_unauthorized }
648
+ end
649
+ ```
650
+
651
+ ##### respond_with_402
652
+ ```ruby
653
+ describe curl("https://example.org") do
654
+ it { should respond_with_402 }
655
+ end
656
+ ```
657
+
658
+ ##### respond_with_PAYMENT_REQUIRED
659
+ ```ruby
660
+ describe curl("https://example.org") do
661
+ it { should respond_with_PAYMENT_REQUIRED }
662
+ end
663
+ ```
664
+
665
+ ##### respond_with_payment_required
666
+ ```ruby
667
+ describe curl("https://example.org") do
668
+ it { should respond_with_payment_required }
669
+ end
670
+ ```
671
+
672
+ ##### be_payment_required
673
+ ```ruby
674
+ describe curl("https://example.org") do
675
+ it { should be_payment_required }
676
+ end
677
+ ```
678
+
679
+ ##### respond_with_403
680
+ ```ruby
681
+ describe curl("https://example.org") do
682
+ it { should respond_with_403 }
683
+ end
684
+ ```
685
+
686
+ ##### respond_with_FORBIDDEN
687
+ ```ruby
688
+ describe curl("https://example.org") do
689
+ it { should respond_with_FORBIDDEN }
690
+ end
691
+ ```
692
+
693
+ ##### respond_with_forbidden
694
+ ```ruby
695
+ describe curl("https://example.org") do
696
+ it { should respond_with_forbidden }
697
+ end
698
+ ```
699
+
700
+ ##### be_forbidden
701
+ ```ruby
702
+ describe curl("https://example.org") do
703
+ it { should be_forbidden }
704
+ end
705
+ ```
706
+
707
+ ##### respond_with_404
708
+ ```ruby
709
+ describe curl("https://example.org") do
710
+ it { should respond_with_404 }
711
+ end
712
+ ```
713
+
714
+ ##### respond_with_NOT_FOUND
715
+ ```ruby
716
+ describe curl("https://example.org") do
717
+ it { should respond_with_NOT_FOUND }
718
+ end
719
+ ```
720
+
721
+ ##### respond_with_not_found
722
+ ```ruby
723
+ describe curl("https://example.org") do
724
+ it { should respond_with_not_found }
725
+ end
726
+ ```
727
+
728
+ ##### be_not_found
729
+ ```ruby
730
+ describe curl("https://example.org") do
731
+ it { should be_not_found }
732
+ end
733
+ ```
734
+
735
+ ##### respond_with_405
736
+ ```ruby
737
+ describe curl("https://example.org") do
738
+ it { should respond_with_405 }
739
+ end
740
+ ```
741
+
742
+ ##### respond_with_METHOD_NOT_ALLOWED
743
+ ```ruby
744
+ describe curl("https://example.org") do
745
+ it { should respond_with_METHOD_NOT_ALLOWED }
746
+ end
747
+ ```
748
+
749
+ ##### respond_with_method_not_allowed
750
+ ```ruby
751
+ describe curl("https://example.org") do
752
+ it { should respond_with_method_not_allowed }
753
+ end
754
+ ```
755
+
756
+ ##### be_method_not_allowed
757
+ ```ruby
758
+ describe curl("https://example.org") do
759
+ it { should be_method_not_allowed }
760
+ end
761
+ ```
762
+
763
+ ##### respond_with_406
764
+ ```ruby
765
+ describe curl("https://example.org") do
766
+ it { should respond_with_406 }
767
+ end
768
+ ```
769
+
770
+ ##### respond_with_NOT_ACCEPTABLE
771
+ ```ruby
772
+ describe curl("https://example.org") do
773
+ it { should respond_with_NOT_ACCEPTABLE }
774
+ end
775
+ ```
776
+
777
+ ##### respond_with_not_acceptable
778
+ ```ruby
779
+ describe curl("https://example.org") do
780
+ it { should respond_with_not_acceptable }
781
+ end
782
+ ```
783
+
784
+ ##### be_not_acceptable
785
+ ```ruby
786
+ describe curl("https://example.org") do
787
+ it { should be_not_acceptable }
788
+ end
789
+ ```
790
+
791
+ ##### respond_with_407
792
+ ```ruby
793
+ describe curl("https://example.org") do
794
+ it { should respond_with_407 }
795
+ end
796
+ ```
797
+
798
+ ##### respond_with_PROXY_AUTHENTICATION_REQUIRED
799
+ ```ruby
800
+ describe curl("https://example.org") do
801
+ it { should respond_with_PROXY_AUTHENTICATION_REQUIRED }
802
+ end
803
+ ```
804
+
805
+ ##### respond_with_proxy_authentication_required
806
+ ```ruby
807
+ describe curl("https://example.org") do
808
+ it { should respond_with_proxy_authentication_required }
809
+ end
810
+ ```
811
+
812
+ ##### be_proxy_authentication_required
813
+ ```ruby
814
+ describe curl("https://example.org") do
815
+ it { should be_proxy_authentication_required }
816
+ end
817
+ ```
818
+
819
+ ##### respond_with_408
820
+ ```ruby
821
+ describe curl("https://example.org") do
822
+ it { should respond_with_408 }
823
+ end
824
+ ```
825
+
826
+ ##### respond_with_REQUEST_TIMEOUT
827
+ ```ruby
828
+ describe curl("https://example.org") do
829
+ it { should respond_with_REQUEST_TIMEOUT }
830
+ end
831
+ ```
832
+
833
+ ##### respond_with_request_timeout
834
+ ```ruby
835
+ describe curl("https://example.org") do
836
+ it { should respond_with_request_timeout }
837
+ end
838
+ ```
839
+
840
+ ##### be_request_timeout
841
+ ```ruby
842
+ describe curl("https://example.org") do
843
+ it { should be_request_timeout }
844
+ end
845
+ ```
846
+
847
+ ##### respond_with_409
848
+ ```ruby
849
+ describe curl("https://example.org") do
850
+ it { should respond_with_409 }
851
+ end
852
+ ```
853
+
854
+ ##### respond_with_CONFLICT
855
+ ```ruby
856
+ describe curl("https://example.org") do
857
+ it { should respond_with_CONFLICT }
858
+ end
859
+ ```
860
+
861
+ ##### respond_with_conflict
862
+ ```ruby
863
+ describe curl("https://example.org") do
864
+ it { should respond_with_conflict }
865
+ end
866
+ ```
867
+
868
+ ##### be_conflict
869
+ ```ruby
870
+ describe curl("https://example.org") do
871
+ it { should be_conflict }
872
+ end
873
+ ```
874
+
875
+ ##### respond_with_410
876
+ ```ruby
877
+ describe curl("https://example.org") do
878
+ it { should respond_with_410 }
879
+ end
880
+ ```
881
+
882
+ ##### respond_with_GONE
883
+ ```ruby
884
+ describe curl("https://example.org") do
885
+ it { should respond_with_GONE }
886
+ end
887
+ ```
888
+
889
+ ##### respond_with_gone
890
+ ```ruby
891
+ describe curl("https://example.org") do
892
+ it { should respond_with_gone }
893
+ end
894
+ ```
895
+
896
+ ##### be_gone
897
+ ```ruby
898
+ describe curl("https://example.org") do
899
+ it { should be_gone }
900
+ end
901
+ ```
902
+
903
+ ##### respond_with_411
904
+ ```ruby
905
+ describe curl("https://example.org") do
906
+ it { should respond_with_411 }
907
+ end
908
+ ```
909
+
910
+ ##### respond_with_LENGTH_REQUIRED
911
+ ```ruby
912
+ describe curl("https://example.org") do
913
+ it { should respond_with_LENGTH_REQUIRED }
914
+ end
915
+ ```
916
+
917
+ ##### respond_with_length_required
918
+ ```ruby
919
+ describe curl("https://example.org") do
920
+ it { should respond_with_length_required }
921
+ end
922
+ ```
923
+
924
+ ##### be_length_required
925
+ ```ruby
926
+ describe curl("https://example.org") do
927
+ it { should be_length_required }
928
+ end
929
+ ```
930
+
931
+ ##### respond_with_412
932
+ ```ruby
933
+ describe curl("https://example.org") do
934
+ it { should respond_with_412 }
935
+ end
936
+ ```
937
+
938
+ ##### respond_with_PRECONDITION_FAILED
939
+ ```ruby
940
+ describe curl("https://example.org") do
941
+ it { should respond_with_PRECONDITION_FAILED }
942
+ end
943
+ ```
944
+
945
+ ##### respond_with_precondition_failed
946
+ ```ruby
947
+ describe curl("https://example.org") do
948
+ it { should respond_with_precondition_failed }
949
+ end
950
+ ```
951
+
952
+ ##### be_precondition_failed
953
+ ```ruby
954
+ describe curl("https://example.org") do
955
+ it { should be_precondition_failed }
956
+ end
957
+ ```
958
+
959
+ ##### respond_with_413
960
+ ```ruby
961
+ describe curl("https://example.org") do
962
+ it { should respond_with_413 }
963
+ end
964
+ ```
965
+
966
+ ##### respond_with_PAYLOAD_TOO_LARGE
967
+ ```ruby
968
+ describe curl("https://example.org") do
969
+ it { should respond_with_PAYLOAD_TOO_LARGE }
970
+ end
971
+ ```
972
+
973
+ ##### respond_with_payload_too_large
974
+ ```ruby
975
+ describe curl("https://example.org") do
976
+ it { should respond_with_payload_too_large }
977
+ end
978
+ ```
979
+
980
+ ##### be_payload_too_large
981
+ ```ruby
982
+ describe curl("https://example.org") do
983
+ it { should be_payload_too_large }
984
+ end
985
+ ```
986
+
987
+ ##### respond_with_414
988
+ ```ruby
989
+ describe curl("https://example.org") do
990
+ it { should respond_with_414 }
991
+ end
992
+ ```
993
+
994
+ ##### respond_with_REQUEST_URI_TOO_LONG
995
+ ```ruby
996
+ describe curl("https://example.org") do
997
+ it { should respond_with_REQUEST_URI_TOO_LONG }
998
+ end
999
+ ```
1000
+
1001
+ ##### respond_with_request_uri_too_long
1002
+ ```ruby
1003
+ describe curl("https://example.org") do
1004
+ it { should respond_with_request_uri_too_long }
1005
+ end
1006
+ ```
1007
+
1008
+ ##### be_request_uri_too_long
1009
+ ```ruby
1010
+ describe curl("https://example.org") do
1011
+ it { should be_request_uri_too_long }
1012
+ end
1013
+ ```
1014
+
1015
+ ##### respond_with_415
1016
+ ```ruby
1017
+ describe curl("https://example.org") do
1018
+ it { should respond_with_415 }
1019
+ end
1020
+ ```
1021
+
1022
+ ##### respond_with_UNSUPPORTED_MEDIA_TYPE
1023
+ ```ruby
1024
+ describe curl("https://example.org") do
1025
+ it { should respond_with_UNSUPPORTED_MEDIA_TYPE }
1026
+ end
1027
+ ```
1028
+
1029
+ ##### respond_with_unsupported_media_type
1030
+ ```ruby
1031
+ describe curl("https://example.org") do
1032
+ it { should respond_with_unsupported_media_type }
1033
+ end
1034
+ ```
1035
+
1036
+ ##### be_unsupported_media_type
1037
+ ```ruby
1038
+ describe curl("https://example.org") do
1039
+ it { should be_unsupported_media_type }
1040
+ end
1041
+ ```
1042
+
1043
+ ##### respond_with_416
1044
+ ```ruby
1045
+ describe curl("https://example.org") do
1046
+ it { should respond_with_416 }
1047
+ end
1048
+ ```
1049
+
1050
+ ##### respond_with_REQUESTED_RANGE_NOT_SATISFIABLE
1051
+ ```ruby
1052
+ describe curl("https://example.org") do
1053
+ it { should respond_with_REQUESTED_RANGE_NOT_SATISFIABLE }
1054
+ end
1055
+ ```
1056
+
1057
+ ##### respond_with_requested_range_not_satisfiable
1058
+ ```ruby
1059
+ describe curl("https://example.org") do
1060
+ it { should respond_with_requested_range_not_satisfiable }
1061
+ end
1062
+ ```
1063
+
1064
+ ##### be_requested_range_not_satisfiable
1065
+ ```ruby
1066
+ describe curl("https://example.org") do
1067
+ it { should be_requested_range_not_satisfiable }
1068
+ end
1069
+ ```
1070
+
1071
+ ##### respond_with_417
1072
+ ```ruby
1073
+ describe curl("https://example.org") do
1074
+ it { should respond_with_417 }
1075
+ end
1076
+ ```
1077
+
1078
+ ##### respond_with_EXPECTATION_FAILED
1079
+ ```ruby
1080
+ describe curl("https://example.org") do
1081
+ it { should respond_with_EXPECTATION_FAILED }
1082
+ end
1083
+ ```
1084
+
1085
+ ##### respond_with_expectation_failed
1086
+ ```ruby
1087
+ describe curl("https://example.org") do
1088
+ it { should respond_with_expectation_failed }
1089
+ end
1090
+ ```
1091
+
1092
+ ##### be_expectation_failed
1093
+ ```ruby
1094
+ describe curl("https://example.org") do
1095
+ it { should be_expectation_failed }
1096
+ end
1097
+ ```
1098
+
1099
+ ##### respond_with_418
1100
+ ```ruby
1101
+ describe curl("https://example.org") do
1102
+ it { should respond_with_418 }
1103
+ end
1104
+ ```
1105
+
1106
+ ##### respond_with_IM_A_TEAPOT
1107
+ ```ruby
1108
+ describe curl("https://example.org") do
1109
+ it { should respond_with_IM_A_TEAPOT }
1110
+ end
1111
+ ```
1112
+
1113
+ ##### respond_with_im_a_teapot
1114
+ ```ruby
1115
+ describe curl("https://example.org") do
1116
+ it { should respond_with_im_a_teapot }
1117
+ end
1118
+ ```
1119
+
1120
+ ##### be_im_a_teapot
1121
+ ```ruby
1122
+ describe curl("https://example.org") do
1123
+ it { should be_im_a_teapot }
1124
+ end
1125
+ ```
1126
+
1127
+ ##### respond_with_421
1128
+ ```ruby
1129
+ describe curl("https://example.org") do
1130
+ it { should respond_with_421 }
1131
+ end
1132
+ ```
1133
+
1134
+ ##### respond_with_MISDIRECTED_REQUEST
1135
+ ```ruby
1136
+ describe curl("https://example.org") do
1137
+ it { should respond_with_MISDIRECTED_REQUEST }
1138
+ end
1139
+ ```
1140
+
1141
+ ##### respond_with_misdirected_request
1142
+ ```ruby
1143
+ describe curl("https://example.org") do
1144
+ it { should respond_with_misdirected_request }
1145
+ end
1146
+ ```
1147
+
1148
+ ##### be_misdirected_request
1149
+ ```ruby
1150
+ describe curl("https://example.org") do
1151
+ it { should be_misdirected_request }
1152
+ end
1153
+ ```
1154
+
1155
+ ##### respond_with_422
1156
+ ```ruby
1157
+ describe curl("https://example.org") do
1158
+ it { should respond_with_422 }
1159
+ end
1160
+ ```
1161
+
1162
+ ##### respond_with_UNPROCESSABLE_ENTITY
1163
+ ```ruby
1164
+ describe curl("https://example.org") do
1165
+ it { should respond_with_UNPROCESSABLE_ENTITY }
1166
+ end
1167
+ ```
1168
+
1169
+ ##### respond_with_unprocessable_entity
1170
+ ```ruby
1171
+ describe curl("https://example.org") do
1172
+ it { should respond_with_unprocessable_entity }
1173
+ end
1174
+ ```
1175
+
1176
+ ##### be_unprocessable_entity
1177
+ ```ruby
1178
+ describe curl("https://example.org") do
1179
+ it { should be_unprocessable_entity }
1180
+ end
1181
+ ```
1182
+
1183
+ ##### respond_with_423
1184
+ ```ruby
1185
+ describe curl("https://example.org") do
1186
+ it { should respond_with_423 }
1187
+ end
1188
+ ```
1189
+
1190
+ ##### respond_with_LOCKED
1191
+ ```ruby
1192
+ describe curl("https://example.org") do
1193
+ it { should respond_with_LOCKED }
1194
+ end
1195
+ ```
1196
+
1197
+ ##### respond_with_locked
1198
+ ```ruby
1199
+ describe curl("https://example.org") do
1200
+ it { should respond_with_locked }
1201
+ end
1202
+ ```
1203
+
1204
+ ##### be_locked
1205
+ ```ruby
1206
+ describe curl("https://example.org") do
1207
+ it { should be_locked }
1208
+ end
1209
+ ```
1210
+
1211
+ ##### respond_with_424
1212
+ ```ruby
1213
+ describe curl("https://example.org") do
1214
+ it { should respond_with_424 }
1215
+ end
1216
+ ```
1217
+
1218
+ ##### respond_with_FAILED_DEPENDENCY
1219
+ ```ruby
1220
+ describe curl("https://example.org") do
1221
+ it { should respond_with_FAILED_DEPENDENCY }
1222
+ end
1223
+ ```
1224
+
1225
+ ##### respond_with_failed_dependency
1226
+ ```ruby
1227
+ describe curl("https://example.org") do
1228
+ it { should respond_with_failed_dependency }
1229
+ end
1230
+ ```
1231
+
1232
+ ##### be_failed_dependency
1233
+ ```ruby
1234
+ describe curl("https://example.org") do
1235
+ it { should be_failed_dependency }
1236
+ end
1237
+ ```
1238
+
1239
+ ##### respond_with_426
1240
+ ```ruby
1241
+ describe curl("https://example.org") do
1242
+ it { should respond_with_426 }
1243
+ end
1244
+ ```
1245
+
1246
+ ##### respond_with_UPGRADE_REQUIRED
1247
+ ```ruby
1248
+ describe curl("https://example.org") do
1249
+ it { should respond_with_UPGRADE_REQUIRED }
1250
+ end
1251
+ ```
1252
+
1253
+ ##### respond_with_upgrade_required
1254
+ ```ruby
1255
+ describe curl("https://example.org") do
1256
+ it { should respond_with_upgrade_required }
1257
+ end
1258
+ ```
1259
+
1260
+ ##### be_upgrade_required
1261
+ ```ruby
1262
+ describe curl("https://example.org") do
1263
+ it { should be_upgrade_required }
1264
+ end
1265
+ ```
1266
+
1267
+ ##### respond_with_428
1268
+ ```ruby
1269
+ describe curl("https://example.org") do
1270
+ it { should respond_with_428 }
1271
+ end
1272
+ ```
1273
+
1274
+ ##### respond_with_PRECONDITION_REQUIRED
1275
+ ```ruby
1276
+ describe curl("https://example.org") do
1277
+ it { should respond_with_PRECONDITION_REQUIRED }
1278
+ end
1279
+ ```
1280
+
1281
+ ##### respond_with_precondition_required
1282
+ ```ruby
1283
+ describe curl("https://example.org") do
1284
+ it { should respond_with_precondition_required }
1285
+ end
1286
+ ```
1287
+
1288
+ ##### be_precondition_required
1289
+ ```ruby
1290
+ describe curl("https://example.org") do
1291
+ it { should be_precondition_required }
1292
+ end
1293
+ ```
1294
+
1295
+ ##### respond_with_429
1296
+ ```ruby
1297
+ describe curl("https://example.org") do
1298
+ it { should respond_with_429 }
1299
+ end
1300
+ ```
1301
+
1302
+ ##### respond_with_TOO_MANY_REQUESTS
1303
+ ```ruby
1304
+ describe curl("https://example.org") do
1305
+ it { should respond_with_TOO_MANY_REQUESTS }
1306
+ end
1307
+ ```
1308
+
1309
+ ##### respond_with_too_many_requests
1310
+ ```ruby
1311
+ describe curl("https://example.org") do
1312
+ it { should respond_with_too_many_requests }
1313
+ end
1314
+ ```
1315
+
1316
+ ##### be_too_many_requests
1317
+ ```ruby
1318
+ describe curl("https://example.org") do
1319
+ it { should be_too_many_requests }
1320
+ end
1321
+ ```
1322
+
1323
+ ##### respond_with_431
1324
+ ```ruby
1325
+ describe curl("https://example.org") do
1326
+ it { should respond_with_431 }
1327
+ end
1328
+ ```
1329
+
1330
+ ##### respond_with_REQUEST_HEADER_FIELDS_TOO_LARGE
1331
+ ```ruby
1332
+ describe curl("https://example.org") do
1333
+ it { should respond_with_REQUEST_HEADER_FIELDS_TOO_LARGE }
1334
+ end
1335
+ ```
1336
+
1337
+ ##### respond_with_request_header_fields_too_large
1338
+ ```ruby
1339
+ describe curl("https://example.org") do
1340
+ it { should respond_with_request_header_fields_too_large }
1341
+ end
1342
+ ```
1343
+
1344
+ ##### be_request_header_fields_too_large
1345
+ ```ruby
1346
+ describe curl("https://example.org") do
1347
+ it { should be_request_header_fields_too_large }
1348
+ end
1349
+ ```
1350
+
1351
+ ##### respond_with_444
1352
+ ```ruby
1353
+ describe curl("https://example.org") do
1354
+ it { should respond_with_444 }
1355
+ end
1356
+ ```
1357
+
1358
+ ##### respond_with_CONNECTION_CLOSED_WITHOUT_RESPONSE
1359
+ ```ruby
1360
+ describe curl("https://example.org") do
1361
+ it { should respond_with_CONNECTION_CLOSED_WITHOUT_RESPONSE }
1362
+ end
1363
+ ```
1364
+
1365
+ ##### respond_with_connection_closed_without_response
1366
+ ```ruby
1367
+ describe curl("https://example.org") do
1368
+ it { should respond_with_connection_closed_without_response }
1369
+ end
1370
+ ```
1371
+
1372
+ ##### be_connection_closed_without_response
1373
+ ```ruby
1374
+ describe curl("https://example.org") do
1375
+ it { should be_connection_closed_without_response }
1376
+ end
1377
+ ```
1378
+
1379
+ ##### respond_with_451
1380
+ ```ruby
1381
+ describe curl("https://example.org") do
1382
+ it { should respond_with_451 }
1383
+ end
1384
+ ```
1385
+
1386
+ ##### respond_with_UNAVAILABLE_FOR_LEGAL_REASONS
1387
+ ```ruby
1388
+ describe curl("https://example.org") do
1389
+ it { should respond_with_UNAVAILABLE_FOR_LEGAL_REASONS }
1390
+ end
1391
+ ```
1392
+
1393
+ ##### respond_with_unavailable_for_legal_reasons
1394
+ ```ruby
1395
+ describe curl("https://example.org") do
1396
+ it { should respond_with_unavailable_for_legal_reasons }
1397
+ end
1398
+ ```
1399
+
1400
+ ##### be_unavailable_for_legal_reasons
1401
+ ```ruby
1402
+ describe curl("https://example.org") do
1403
+ it { should be_unavailable_for_legal_reasons }
1404
+ end
1405
+ ```
1406
+
1407
+ ##### respond_with_499
1408
+ ```ruby
1409
+ describe curl("https://example.org") do
1410
+ it { should respond_with_499 }
1411
+ end
1412
+ ```
1413
+
1414
+ ##### respond_with_CLIENT_CLOSED_REQUEST
1415
+ ```ruby
1416
+ describe curl("https://example.org") do
1417
+ it { should respond_with_CLIENT_CLOSED_REQUEST }
1418
+ end
1419
+ ```
1420
+
1421
+ ##### respond_with_client_closed_request
1422
+ ```ruby
1423
+ describe curl("https://example.org") do
1424
+ it { should respond_with_client_closed_request }
1425
+ end
1426
+ ```
1427
+
1428
+ ##### be_client_closed_request
1429
+ ```ruby
1430
+ describe curl("https://example.org") do
1431
+ it { should be_client_closed_request }
1432
+ end
1433
+ ```
1434
+
1435
+ ### HTTP_5xx matchers <a name="http_5xxx"></a>
1436
+ ##### respond_with_500
1437
+ ```ruby
1438
+ describe curl("https://example.org") do
1439
+ it { should respond_with_500 }
1440
+ end
1441
+ ```
1442
+
1443
+ ##### respond_with_INTERNAL_SERVER_ERROR
1444
+ ```ruby
1445
+ describe curl("https://example.org") do
1446
+ it { should respond_with_INTERNAL_SERVER_ERROR }
1447
+ end
1448
+ ```
1449
+
1450
+ ##### respond_with_internal_server_error
1451
+ ```ruby
1452
+ describe curl("https://example.org") do
1453
+ it { should respond_with_internal_server_error }
1454
+ end
1455
+ ```
1456
+
1457
+ ##### be_internal_server_error
1458
+ ```ruby
1459
+ describe curl("https://example.org") do
1460
+ it { should be_internal_server_error }
1461
+ end
1462
+ ```
1463
+
1464
+ ##### respond_with_501
1465
+ ```ruby
1466
+ describe curl("https://example.org") do
1467
+ it { should respond_with_501 }
1468
+ end
1469
+ ```
1470
+
1471
+ ##### respond_with_NOT_IMPLEMENTED
1472
+ ```ruby
1473
+ describe curl("https://example.org") do
1474
+ it { should respond_with_NOT_IMPLEMENTED }
1475
+ end
1476
+ ```
1477
+
1478
+ ##### respond_with_not_implemented
1479
+ ```ruby
1480
+ describe curl("https://example.org") do
1481
+ it { should respond_with_not_implemented }
1482
+ end
1483
+ ```
1484
+
1485
+ ##### be_not_implemented
1486
+ ```ruby
1487
+ describe curl("https://example.org") do
1488
+ it { should be_not_implemented }
1489
+ end
1490
+ ```
1491
+
1492
+ ##### respond_with_502
1493
+ ```ruby
1494
+ describe curl("https://example.org") do
1495
+ it { should respond_with_502 }
1496
+ end
1497
+ ```
1498
+
1499
+ ##### respond_with_BAD_GATEWAY
1500
+ ```ruby
1501
+ describe curl("https://example.org") do
1502
+ it { should respond_with_BAD_GATEWAY }
1503
+ end
1504
+ ```
1505
+
1506
+ ##### respond_with_bad_gateway
1507
+ ```ruby
1508
+ describe curl("https://example.org") do
1509
+ it { should respond_with_bad_gateway }
1510
+ end
1511
+ ```
1512
+
1513
+ ##### be_bad_gateway
1514
+ ```ruby
1515
+ describe curl("https://example.org") do
1516
+ it { should be_bad_gateway }
1517
+ end
1518
+ ```
1519
+
1520
+ ##### respond_with_503
1521
+ ```ruby
1522
+ describe curl("https://example.org") do
1523
+ it { should respond_with_503 }
1524
+ end
1525
+ ```
1526
+
1527
+ ##### respond_with_SERVICE_UNAVAILABLE
1528
+ ```ruby
1529
+ describe curl("https://example.org") do
1530
+ it { should respond_with_SERVICE_UNAVAILABLE }
1531
+ end
1532
+ ```
1533
+
1534
+ ##### respond_with_service_unavailable
1535
+ ```ruby
1536
+ describe curl("https://example.org") do
1537
+ it { should respond_with_service_unavailable }
1538
+ end
1539
+ ```
1540
+
1541
+ ##### be_service_unavailable
1542
+ ```ruby
1543
+ describe curl("https://example.org") do
1544
+ it { should be_service_unavailable }
1545
+ end
1546
+ ```
1547
+
1548
+ ##### respond_with_504
1549
+ ```ruby
1550
+ describe curl("https://example.org") do
1551
+ it { should respond_with_504 }
1552
+ end
1553
+ ```
1554
+
1555
+ ##### respond_with_GATEWAY_TIMEOUT
1556
+ ```ruby
1557
+ describe curl("https://example.org") do
1558
+ it { should respond_with_GATEWAY_TIMEOUT }
1559
+ end
1560
+ ```
1561
+
1562
+ ##### respond_with_gateway_timeout
1563
+ ```ruby
1564
+ describe curl("https://example.org") do
1565
+ it { should respond_with_gateway_timeout }
1566
+ end
1567
+ ```
1568
+
1569
+ ##### be_gateway_timeout
1570
+ ```ruby
1571
+ describe curl("https://example.org") do
1572
+ it { should be_gateway_timeout }
1573
+ end
1574
+ ```
1575
+
1576
+ ##### respond_with_505
1577
+ ```ruby
1578
+ describe curl("https://example.org") do
1579
+ it { should respond_with_505 }
1580
+ end
1581
+ ```
1582
+
1583
+ ##### respond_with_HTTP_VERSION_NOT_SUPPORTED
1584
+ ```ruby
1585
+ describe curl("https://example.org") do
1586
+ it { should respond_with_HTTP_VERSION_NOT_SUPPORTED }
1587
+ end
1588
+ ```
1589
+
1590
+ ##### respond_with_http_version_not_supported
1591
+ ```ruby
1592
+ describe curl("https://example.org") do
1593
+ it { should respond_with_http_version_not_supported }
1594
+ end
1595
+ ```
1596
+
1597
+ ##### be_http_version_not_supported
1598
+ ```ruby
1599
+ describe curl("https://example.org") do
1600
+ it { should be_http_version_not_supported }
1601
+ end
1602
+ ```
1603
+
1604
+ ##### respond_with_506
1605
+ ```ruby
1606
+ describe curl("https://example.org") do
1607
+ it { should respond_with_506 }
1608
+ end
1609
+ ```
1610
+
1611
+ ##### respond_with_VARIANT_ALSO_NEGOTIATES
1612
+ ```ruby
1613
+ describe curl("https://example.org") do
1614
+ it { should respond_with_VARIANT_ALSO_NEGOTIATES }
1615
+ end
1616
+ ```
1617
+
1618
+ ##### respond_with_variant_also_negotiates
1619
+ ```ruby
1620
+ describe curl("https://example.org") do
1621
+ it { should respond_with_variant_also_negotiates }
1622
+ end
1623
+ ```
1624
+
1625
+ ##### be_variant_also_negotiates
1626
+ ```ruby
1627
+ describe curl("https://example.org") do
1628
+ it { should be_variant_also_negotiates }
1629
+ end
1630
+ ```
1631
+
1632
+ ##### respond_with_507
1633
+ ```ruby
1634
+ describe curl("https://example.org") do
1635
+ it { should respond_with_507 }
1636
+ end
1637
+ ```
1638
+
1639
+ ##### respond_with_INSUFFICIENT_STORAGE
1640
+ ```ruby
1641
+ describe curl("https://example.org") do
1642
+ it { should respond_with_INSUFFICIENT_STORAGE }
1643
+ end
1644
+ ```
1645
+
1646
+ ##### respond_with_insufficient_storage
1647
+ ```ruby
1648
+ describe curl("https://example.org") do
1649
+ it { should respond_with_insufficient_storage }
1650
+ end
1651
+ ```
1652
+
1653
+ ##### be_insufficient_storage
1654
+ ```ruby
1655
+ describe curl("https://example.org") do
1656
+ it { should be_insufficient_storage }
1657
+ end
1658
+ ```
1659
+
1660
+ ##### respond_with_508
1661
+ ```ruby
1662
+ describe curl("https://example.org") do
1663
+ it { should respond_with_508 }
1664
+ end
1665
+ ```
1666
+
1667
+ ##### respond_with_LOOP_DETECTED
1668
+ ```ruby
1669
+ describe curl("https://example.org") do
1670
+ it { should respond_with_LOOP_DETECTED }
1671
+ end
1672
+ ```
1673
+
1674
+ ##### respond_with_loop_detected
1675
+ ```ruby
1676
+ describe curl("https://example.org") do
1677
+ it { should respond_with_loop_detected }
1678
+ end
1679
+ ```
1680
+
1681
+ ##### be_loop_detected
1682
+ ```ruby
1683
+ describe curl("https://example.org") do
1684
+ it { should be_loop_detected }
1685
+ end
1686
+ ```
1687
+
1688
+ ##### respond_with_510
1689
+ ```ruby
1690
+ describe curl("https://example.org") do
1691
+ it { should respond_with_510 }
1692
+ end
1693
+ ```
1694
+
1695
+ ##### respond_with_NOT_EXTENDED
1696
+ ```ruby
1697
+ describe curl("https://example.org") do
1698
+ it { should respond_with_NOT_EXTENDED }
1699
+ end
1700
+ ```
1701
+
1702
+ ##### respond_with_not_extended
1703
+ ```ruby
1704
+ describe curl("https://example.org") do
1705
+ it { should respond_with_not_extended }
1706
+ end
1707
+ ```
1708
+
1709
+ ##### be_not_extended
1710
+ ```ruby
1711
+ describe curl("https://example.org") do
1712
+ it { should be_not_extended }
1713
+ end
1714
+ ```
1715
+
1716
+ ##### respond_with_511
1717
+ ```ruby
1718
+ describe curl("https://example.org") do
1719
+ it { should respond_with_511 }
1720
+ end
1721
+ ```
1722
+
1723
+ ##### respond_with_NETWORK_AUTHENTICATION_REQUIRED
1724
+ ```ruby
1725
+ describe curl("https://example.org") do
1726
+ it { should respond_with_NETWORK_AUTHENTICATION_REQUIRED }
1727
+ end
1728
+ ```
1729
+
1730
+ ##### respond_with_network_authentication_required
1731
+ ```ruby
1732
+ describe curl("https://example.org") do
1733
+ it { should respond_with_network_authentication_required }
1734
+ end
1735
+ ```
1736
+
1737
+ ##### be_network_authentication_required
1738
+ ```ruby
1739
+ describe curl("https://example.org") do
1740
+ it { should be_network_authentication_required }
1741
+ end
1742
+ ```
1743
+
1744
+ ##### respond_with_599
1745
+ ```ruby
1746
+ describe curl("https://example.org") do
1747
+ it { should respond_with_599 }
1748
+ end
1749
+ ```
1750
+
1751
+ ##### respond_with_NETWORK_CONNECT_TIMEOUT_ERROR
1752
+ ```ruby
1753
+ describe curl("https://example.org") do
1754
+ it { should respond_with_NETWORK_CONNECT_TIMEOUT_ERROR }
1755
+ end
1756
+ ```
1757
+
1758
+ ##### respond_with_network_connect_timeout_error
1759
+ ```ruby
1760
+ describe curl("https://example.org") do
1761
+ it { should respond_with_network_connect_timeout_error }
1762
+ end
1763
+ ```
1764
+
1765
+ ##### be_network_connect_timeout_error
1766
+ ```ruby
1767
+ describe curl("https://example.org") do
1768
+ it { should be_network_connect_timeout_error }
1769
+ end
1770
+ ```
1771
+