arachni 1.2.1 → 1.3

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.
Files changed (373) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/Gemfile +1 -1
  4. data/README.md +16 -5
  5. data/components/checks/active/ldap_injection/errors.txt +1 -0
  6. data/components/checks/active/source_code_disclosure.rb +1 -1
  7. data/components/checks/active/unvalidated_redirect.rb +6 -6
  8. data/components/checks/active/unvalidated_redirect_dom.rb +10 -7
  9. data/components/checks/passive/grep/captcha.rb +14 -5
  10. data/components/checks/passive/grep/form_upload.rb +7 -3
  11. data/components/checks/passive/grep/hsts.rb +3 -3
  12. data/components/checks/passive/grep/html_objects.rb +2 -3
  13. data/components/checks/passive/grep/http_only_cookies.rb +2 -3
  14. data/components/checks/passive/grep/insecure_cookies.rb +1 -1
  15. data/components/checks/passive/grep/password_autocomplete.rb +2 -2
  16. data/components/checks/passive/grep/unencrypted_password_forms.rb +7 -7
  17. data/components/checks/passive/grep/x_frame_options.rb +2 -2
  18. data/components/checks/passive/http_put.rb +2 -3
  19. data/components/path_extractors/comments.rb +3 -3
  20. data/components/path_extractors/scripts.rb +10 -1
  21. data/components/plugins/defaults/autothrottle.rb +27 -18
  22. data/components/plugins/defaults/meta/remedies/discovery.rb +30 -33
  23. data/components/plugins/defaults/meta/remedies/timing_attacks.rb +7 -11
  24. data/components/plugins/login_script.rb +9 -3
  25. data/components/plugins/proxy.rb +4 -3
  26. data/components/reporters/html.rb +11 -14
  27. data/components/reporters/html/default/issue.erb +13 -38
  28. data/components/reporters/html/default/issue/info.erb +1 -1
  29. data/components/reporters/html/default/summary/issues/by_name.erb +3 -3
  30. data/components/reporters/stdout.rb +62 -71
  31. data/components/reporters/xml.rb +26 -40
  32. data/components/reporters/xml/schema.xsd +43 -89
  33. data/lib/arachni/browser.rb +52 -3
  34. data/lib/arachni/browser/javascript.rb +3 -3
  35. data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -25
  36. data/lib/arachni/browser_cluster.rb +61 -0
  37. data/lib/arachni/browser_cluster/job.rb +21 -1
  38. data/lib/arachni/browser_cluster/jobs/browser_provider.rb +3 -1
  39. data/lib/arachni/browser_cluster/jobs/resource_exploration.rb +2 -1
  40. data/lib/arachni/browser_cluster/jobs/resource_exploration/event_trigger.rb +2 -1
  41. data/lib/arachni/browser_cluster/jobs/taint_trace.rb +3 -2
  42. data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
  43. data/lib/arachni/browser_cluster/worker.rb +5 -0
  44. data/lib/arachni/check/auditor.rb +22 -12
  45. data/lib/arachni/data/framework.rb +13 -1
  46. data/lib/arachni/data/issues.rb +9 -25
  47. data/lib/arachni/element/base.rb +9 -3
  48. data/lib/arachni/element/capabilities/analyzable.rb +2 -6
  49. data/lib/arachni/element/capabilities/analyzable/differential.rb +24 -7
  50. data/lib/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +23 -23
  51. data/lib/arachni/element/capabilities/auditable.rb +0 -6
  52. data/lib/arachni/element/capabilities/dom_only.rb +61 -0
  53. data/lib/arachni/element/capabilities/with_dom.rb +3 -1
  54. data/lib/arachni/element/cookie.rb +35 -5
  55. data/lib/arachni/element/cookie/dom.rb +13 -4
  56. data/lib/arachni/element/{capabilities/auditable/dom.rb → dom.rb} +20 -68
  57. data/lib/arachni/element/dom/capabilities/auditable.rb +29 -0
  58. data/lib/arachni/element/dom/capabilities/inputtable.rb +27 -0
  59. data/lib/arachni/element/dom/capabilities/mutable.rb +21 -0
  60. data/lib/arachni/element/dom/capabilities/submittable.rb +52 -0
  61. data/lib/arachni/element/form.rb +12 -1
  62. data/lib/arachni/element/form/capabilities/mutable.rb +2 -1
  63. data/lib/arachni/element/form/capabilities/with_dom.rb +0 -1
  64. data/lib/arachni/element/form/dom.rb +9 -3
  65. data/lib/arachni/element/header.rb +14 -33
  66. data/lib/arachni/element/header/capabilities/inputtable.rb +29 -0
  67. data/lib/arachni/element/header/capabilities/mutable.rb +51 -0
  68. data/lib/arachni/element/input/dom.rb +71 -0
  69. data/lib/arachni/element/json.rb +2 -0
  70. data/lib/arachni/element/link.rb +3 -0
  71. data/lib/arachni/element/link/capabilities/with_dom.rb +0 -1
  72. data/lib/arachni/element/link/dom.rb +16 -3
  73. data/lib/arachni/element/link/dom/capabilities/submittable.rb +29 -0
  74. data/lib/arachni/element/link_template.rb +3 -5
  75. data/lib/arachni/element/link_template/capabilities/inputtable.rb +5 -0
  76. data/lib/arachni/element/link_template/capabilities/with_dom.rb +0 -1
  77. data/lib/arachni/element/link_template/dom.rb +16 -3
  78. data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +29 -0
  79. data/lib/arachni/element/server.rb +3 -5
  80. data/lib/arachni/element/ui_form.rb +106 -0
  81. data/lib/arachni/element/ui_form/dom.rb +107 -0
  82. data/lib/arachni/element/ui_input.rb +62 -0
  83. data/lib/arachni/element/xml.rb +2 -1
  84. data/lib/arachni/framework.rb +7 -5
  85. data/lib/arachni/framework/parts/audit.rb +0 -1
  86. data/lib/arachni/framework/parts/check.rb +1 -0
  87. data/lib/arachni/framework/parts/data.rb +4 -0
  88. data/lib/arachni/framework/parts/state.rb +0 -2
  89. data/lib/arachni/http/client.rb +17 -6
  90. data/lib/arachni/http/proxy_server.rb +52 -5
  91. data/lib/arachni/http/request.rb +1 -1
  92. data/lib/arachni/issue.rb +34 -179
  93. data/lib/arachni/issue/severity.rb +2 -0
  94. data/lib/arachni/option_groups/audit.rb +22 -2
  95. data/lib/arachni/option_groups/browser_cluster.rb +15 -0
  96. data/lib/arachni/page.rb +3 -2
  97. data/lib/arachni/parser.rb +24 -5
  98. data/lib/arachni/platform/manager.rb +1 -2
  99. data/lib/arachni/rpc/server/framework.rb +3 -4
  100. data/lib/arachni/rpc/server/framework/multi_instance.rb +2 -1
  101. data/lib/arachni/session.rb +1 -1
  102. data/lib/arachni/trainer.rb +4 -7
  103. data/lib/arachni/watir/element.rb +12 -1
  104. data/lib/version +1 -1
  105. data/spec/arachni/browser/element_locator_spec.rb +43 -43
  106. data/spec/arachni/browser/javascript/dom_monitor_spec.rb +44 -44
  107. data/spec/arachni/browser/javascript/proxy/stub_spec.rb +17 -14
  108. data/spec/arachni/browser/javascript/proxy_spec.rb +24 -24
  109. data/spec/arachni/browser/javascript/taint_tracer/frame/called_function_spec.rb +11 -11
  110. data/spec/arachni/browser/javascript/taint_tracer/frame_spec.rb +7 -7
  111. data/spec/arachni/browser/javascript/taint_tracer/sink/data_flow_spec.rb +13 -13
  112. data/spec/arachni/browser/javascript/taint_tracer/sink/execution_flow_spec.rb +7 -7
  113. data/spec/arachni/browser/javascript/taint_tracer_spec.rb +568 -558
  114. data/spec/arachni/browser/javascript_spec.rb +73 -63
  115. data/spec/arachni/browser_cluster/job/result_spec.rb +3 -3
  116. data/spec/arachni/browser_cluster/job_spec.rb +68 -48
  117. data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger/result_spec.rb +2 -2
  118. data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger_spec.rb +5 -4
  119. data/spec/arachni/browser_cluster/jobs/resource_exploration/result_spec.rb +2 -2
  120. data/spec/arachni/browser_cluster/jobs/resource_exploration_spec.rb +5 -5
  121. data/spec/arachni/browser_cluster/worker_spec.rb +87 -70
  122. data/spec/arachni/browser_cluster_spec.rb +64 -39
  123. data/spec/arachni/browser_spec.rb +692 -527
  124. data/spec/arachni/check/auditor_spec.rb +177 -147
  125. data/spec/arachni/check/base_spec.rb +33 -33
  126. data/spec/arachni/check/manager_spec.rb +15 -15
  127. data/spec/arachni/component/base_spec.rb +8 -8
  128. data/spec/arachni/component/manager_spec.rb +100 -99
  129. data/spec/arachni/component/options/address_spec.rb +3 -3
  130. data/spec/arachni/component/options/base_spec.rb +7 -7
  131. data/spec/arachni/component/options/bool_spec.rb +9 -9
  132. data/spec/arachni/component/options/float_spec.rb +6 -6
  133. data/spec/arachni/component/options/int_spec.rb +5 -5
  134. data/spec/arachni/component/options/multiple_choice_spec.rb +12 -12
  135. data/spec/arachni/component/options/object_spec.rb +2 -2
  136. data/spec/arachni/component/options/path_spec.rb +3 -3
  137. data/spec/arachni/component/options/port_spec.rb +5 -5
  138. data/spec/arachni/component/options/string_spec.rb +3 -3
  139. data/spec/arachni/component/options/url_spec.rb +4 -4
  140. data/spec/arachni/component/utilities_spec.rb +2 -2
  141. data/spec/arachni/data/framework/rpc_spec.rb +10 -9
  142. data/spec/arachni/data/framework_spec.rb +65 -46
  143. data/spec/arachni/data/issues_spec.rb +39 -77
  144. data/spec/arachni/data/plugins_spec.rb +11 -11
  145. data/spec/arachni/data/session_spec.rb +6 -6
  146. data/spec/arachni/data_spec.rb +8 -8
  147. data/spec/arachni/element/body_spec.rb +10 -10
  148. data/spec/arachni/element/capabilities/analyzable/differential_spec.rb +39 -21
  149. data/spec/arachni/element/capabilities/analyzable/{taint_spec.rb → signature_spec.rb} +63 -63
  150. data/spec/arachni/element/capabilities/analyzable/timeout_spec.rb +51 -51
  151. data/spec/arachni/element/capabilities/with_scope/scope_spec.rb +5 -5
  152. data/spec/arachni/element/cookie/dom_spec.rb +37 -18
  153. data/spec/arachni/element/cookie_spec.rb +206 -139
  154. data/spec/arachni/element/form/dom_spec.rb +36 -19
  155. data/spec/arachni/element/form_spec.rb +210 -187
  156. data/spec/arachni/element/generic_dom_spec.rb +14 -14
  157. data/spec/arachni/element/header_spec.rb +35 -17
  158. data/spec/arachni/element/json_spec.rb +53 -31
  159. data/spec/arachni/element/link/dom_spec.rb +46 -28
  160. data/spec/arachni/element/link_spec.rb +58 -40
  161. data/spec/arachni/element/link_template/dom_spec.rb +47 -29
  162. data/spec/arachni/element/link_template_spec.rb +79 -61
  163. data/spec/arachni/element/path_spec.rb +1 -1
  164. data/spec/arachni/element/server_spec.rb +33 -32
  165. data/spec/arachni/element/ui_form/ui_form_dom_spec.rb +164 -0
  166. data/spec/arachni/element/ui_form_spec.rb +242 -0
  167. data/spec/arachni/element/ui_input/dom_spec.rb +157 -0
  168. data/spec/arachni/element/ui_input_spec.rb +136 -0
  169. data/spec/arachni/element/xml_spec.rb +42 -24
  170. data/spec/arachni/element_filter_spec.rb +49 -48
  171. data/spec/arachni/error_spec.rb +3 -3
  172. data/spec/arachni/framework/parts/audit_spec.rb +64 -63
  173. data/spec/arachni/framework/parts/browser_spec.rb +16 -16
  174. data/spec/arachni/framework/parts/check_spec.rb +3 -3
  175. data/spec/arachni/framework/parts/data_spec.rb +48 -48
  176. data/spec/arachni/framework/parts/platform_spec.rb +3 -3
  177. data/spec/arachni/framework/parts/plugin_spec.rb +7 -6
  178. data/spec/arachni/framework/parts/report_spec.rb +7 -7
  179. data/spec/arachni/framework/parts/scope_spec.rb +16 -16
  180. data/spec/arachni/framework/parts/state_spec.rb +68 -69
  181. data/spec/arachni/framework_spec.rb +39 -31
  182. data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +32 -32
  183. data/spec/arachni/http/client_spec.rb +219 -208
  184. data/spec/arachni/http/cookie_jar_spec.rb +72 -72
  185. data/spec/arachni/http/headers_spec.rb +14 -14
  186. data/spec/arachni/http/proxy_server_spec.rb +43 -42
  187. data/spec/arachni/http/request_spec.rb +105 -103
  188. data/spec/arachni/http/response/scope_spec.rb +24 -24
  189. data/spec/arachni/http/response_spec.rb +50 -49
  190. data/spec/arachni/issue/severity_spec.rb +10 -9
  191. data/spec/arachni/issue_spec.rb +71 -369
  192. data/spec/arachni/option_groups/audit_spec.rb +114 -114
  193. data/spec/arachni/option_groups/browser_cluster_spec.rb +20 -3
  194. data/spec/arachni/option_groups/datastore_spec.rb +6 -6
  195. data/spec/arachni/option_groups/dispatcher_spec.rb +19 -19
  196. data/spec/arachni/option_groups/http_spec.rb +11 -11
  197. data/spec/arachni/option_groups/input_spec.rb +31 -27
  198. data/spec/arachni/option_groups/output_spec.rb +2 -2
  199. data/spec/arachni/option_groups/paths_spec.rb +17 -17
  200. data/spec/arachni/option_groups/rpc_spec.rb +2 -2
  201. data/spec/arachni/option_groups/scope_spec.rb +40 -40
  202. data/spec/arachni/option_groups/session_spec.rb +6 -5
  203. data/spec/arachni/option_groups/snapshot_spec.rb +4 -4
  204. data/spec/arachni/options_spec.rb +46 -45
  205. data/spec/arachni/page/dom/transition_spec.rb +74 -72
  206. data/spec/arachni/page/dom_spec.rb +35 -35
  207. data/spec/arachni/page/scope_spec.rb +15 -15
  208. data/spec/arachni/page_spec.rb +217 -217
  209. data/spec/arachni/parser_spec.rb +106 -104
  210. data/spec/arachni/platform/fingerprinter_spec.rb +17 -14
  211. data/spec/arachni/platform/list_spec.rb +33 -33
  212. data/spec/arachni/platform/manager_spec.rb +67 -64
  213. data/spec/arachni/plugin/base_spec.rb +10 -10
  214. data/spec/arachni/plugin/manager_spec.rb +38 -37
  215. data/spec/arachni/report_spec.rb +43 -40
  216. data/spec/arachni/reporter/base_spec.rb +15 -15
  217. data/spec/arachni/reporter/manager_spec.rb +4 -4
  218. data/spec/arachni/reporter/options_spec.rb +6 -6
  219. data/spec/arachni/rpc/client/base_spec.rb +6 -6
  220. data/spec/arachni/rpc/client/dispatcher_spec.rb +2 -2
  221. data/spec/arachni/rpc/client/instance_spec.rb +6 -6
  222. data/spec/arachni/rpc/server/active_options_spec.rb +11 -8
  223. data/spec/arachni/rpc/server/base_spec.rb +5 -5
  224. data/spec/arachni/rpc/server/checks/manager_spec.rb +8 -8
  225. data/spec/arachni/rpc/server/dispatcher/node_spec.rb +37 -37
  226. data/spec/arachni/rpc/server/dispatcher/service_spec.rb +15 -14
  227. data/spec/arachni/rpc/server/dispatcher_spec.rb +36 -35
  228. data/spec/arachni/rpc/server/framework/distributor_spec.rb +36 -36
  229. data/spec/arachni/rpc/server/framework_multi_spec.rb +340 -336
  230. data/spec/arachni/rpc/server/framework_spec.rb +90 -85
  231. data/spec/arachni/rpc/server/instance_spec.rb +126 -107
  232. data/spec/arachni/rpc/server/output_spec.rb +1 -1
  233. data/spec/arachni/rpc/server/plugin/manager_spec.rb +6 -6
  234. data/spec/arachni/ruby/array_spec.rb +42 -42
  235. data/spec/arachni/ruby/hash_spec.rb +20 -18
  236. data/spec/arachni/ruby/io_spec.rb +2 -2
  237. data/spec/arachni/ruby/object_spec.rb +1 -1
  238. data/spec/arachni/ruby/set_spec.rb +3 -3
  239. data/spec/arachni/ruby/string_spec.rb +30 -30
  240. data/spec/arachni/ruby/webrick_spec.rb +2 -2
  241. data/spec/arachni/scope_spec.rb +1 -1
  242. data/spec/arachni/session_spec.rb +67 -64
  243. data/spec/arachni/snapshot_spec.rb +15 -15
  244. data/spec/arachni/state/audit_spec.rb +11 -11
  245. data/spec/arachni/state/element_filter_spec.rb +6 -6
  246. data/spec/arachni/state/framework/rpc_spec.rb +12 -12
  247. data/spec/arachni/state/framework_spec.rb +125 -121
  248. data/spec/arachni/state/http_spec.rb +7 -7
  249. data/spec/arachni/state/options_spec.rb +7 -7
  250. data/spec/arachni/state/plugins_spec.rb +8 -8
  251. data/spec/arachni/state_spec.rb +10 -10
  252. data/spec/arachni/support/buffer/autoflush_spec.rb +16 -16
  253. data/spec/arachni/support/buffer/base_spec.rb +39 -39
  254. data/spec/arachni/support/cache/least_cost_replacement_spec.rb +18 -18
  255. data/spec/arachni/support/cache/least_recently_pushed_spec.rb +24 -24
  256. data/spec/arachni/support/cache/least_recently_used_spec.rb +20 -20
  257. data/spec/arachni/support/cache/preference_spec.rb +4 -4
  258. data/spec/arachni/support/cache/random_replacement_spec.rb +8 -8
  259. data/spec/arachni/support/crypto/rsa_aes_cbc_spec.rb +1 -1
  260. data/spec/arachni/support/database/hash_spec.rb +44 -43
  261. data/spec/arachni/support/database/queue_spec.rb +27 -27
  262. data/spec/arachni/support/lookup/hash_set_spec.rb +8 -8
  263. data/spec/arachni/support/lookup/moolb_spec.rb +3 -3
  264. data/spec/arachni/support/mixins/observable_spec.rb +6 -6
  265. data/spec/arachni/support/signature_spec.rb +19 -19
  266. data/spec/arachni/trainer_spec.rb +39 -39
  267. data/spec/arachni/typhoeus/hydra_spec.rb +2 -2
  268. data/spec/arachni/uri/scope_spec.rb +66 -66
  269. data/spec/arachni/uri_spec.rb +107 -105
  270. data/spec/arachni/utilities_spec.rb +40 -40
  271. data/spec/components/checks/active/csrf_spec.rb +8 -8
  272. data/spec/components/checks/active/no_sql_injection_spec.rb +1 -1
  273. data/spec/components/checks/active/sql_injection_spec.rb +16 -16
  274. data/spec/components/checks/active/trainer_spec.rb +4 -4
  275. data/spec/components/checks/active/unvalidated_redirect_dom_spec.rb +4 -2
  276. data/spec/components/checks/active/xpath_injection_spec.rb +1 -1
  277. data/spec/components/checks/active/xss_dom_script_context_spec.rb +51 -21
  278. data/spec/components/checks/active/xss_dom_spec.rb +46 -24
  279. data/spec/components/checks/passive/allowed_methods_spec.rb +1 -1
  280. data/spec/components/checks/passive/grep/cookie_set_for_parent_domain_spec.rb +1 -1
  281. data/spec/components/checks/passive/grep/hsts_spec.rb +2 -2
  282. data/spec/components/checks/passive/grep/http_only_cookies_spec.rb +1 -1
  283. data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +1 -1
  284. data/spec/components/checks/passive/grep/insecure_cors_policy_spec.rb +2 -2
  285. data/spec/components/checks/passive/grep/password_autocomplete_spec.rb +1 -1
  286. data/spec/components/checks/passive/grep/private_ip_spec.rb +3 -3
  287. data/spec/components/checks/passive/grep/unencrypted_password_forms_spec.rb +1 -1
  288. data/spec/components/checks/passive/grep/x_frame_options_spec.rb +2 -2
  289. data/spec/components/checks/passive/interesting_responses_spec.rb +2 -2
  290. data/spec/components/checks/passive/webdav_spec.rb +1 -1
  291. data/spec/components/checks/passive/xst_spec.rb +1 -1
  292. data/spec/components/fingerprinters/servers/apache_spec.rb +2 -2
  293. data/spec/components/path_extractors/comments_spec.rb +5 -1
  294. data/spec/components/path_extractors/scripts_spec.rb +5 -2
  295. data/spec/components/plugins/autologin_spec.rb +22 -22
  296. data/spec/components/plugins/autothrottle_spec.rb +6 -5
  297. data/spec/components/plugins/content_types_spec.rb +4 -4
  298. data/spec/components/plugins/cookie_collector_spec.rb +5 -5
  299. data/spec/components/plugins/exec_spec.rb +12 -12
  300. data/spec/components/plugins/form_dicattack_spec.rb +3 -3
  301. data/spec/components/plugins/headers_collector_spec.rb +8 -8
  302. data/spec/components/plugins/healthmap_spec.rb +3 -3
  303. data/spec/components/plugins/http_dicattack_spec.rb +3 -3
  304. data/spec/components/plugins/login_script_spec.rb +79 -22
  305. data/spec/components/plugins/meta/remedies/discovery_spec.rb +3 -2
  306. data/spec/components/plugins/meta/remedies/timing_attacks_spec.rb +3 -3
  307. data/spec/components/plugins/meta/uniformity_spec.rb +2 -2
  308. data/spec/components/plugins/restrict_to_dom_state_spec.rb +1 -1
  309. data/spec/components/plugins/script_spec.rb +1 -1
  310. data/spec/components/plugins/uncommon_headers_spec.rb +2 -2
  311. data/spec/components/plugins/vector_collector_spec.rb +2 -2
  312. data/spec/components/plugins/vector_feed_spec.rb +40 -40
  313. data/spec/components/plugins/waf_detector_spec.rb +6 -6
  314. data/spec/components/reporters/json_spec.rb +4 -4
  315. data/spec/components/reporters/marshal_spec.rb +2 -2
  316. data/spec/components/reporters/yaml_spec.rb +3 -2
  317. data/spec/external/wavsep/active/sqli_spec.rb +1 -3
  318. data/spec/spec_helper.rb +4 -0
  319. data/spec/support/factories/element/ui_form.rb +14 -0
  320. data/spec/support/factories/element/ui_input.rb +13 -0
  321. data/spec/support/factories/issue.rb +0 -13
  322. data/spec/support/fixtures/report.afr +0 -0
  323. data/spec/support/fixtures/{taint_check/taint.rb → signature_check/signature.rb} +2 -2
  324. data/spec/support/helpers/browser_cluster/jobs/taint_tracer.rb +11 -11
  325. data/spec/support/helpers/framework.rb +1 -1
  326. data/spec/support/helpers/pages.rb +2 -2
  327. data/spec/support/servers/arachni/browser.rb +139 -0
  328. data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +40 -0
  329. data/spec/support/servers/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +0 -0
  330. data/spec/support/servers/arachni/element/input/input_dom.rb +102 -0
  331. data/spec/support/servers/arachni/element/ui_form/ui_form_dom.rb +238 -0
  332. data/spec/support/servers/checks/active/trainer_check.rb +7 -7
  333. data/spec/support/servers/checks/active/unvalidated_redirect_dom.rb +22 -6
  334. data/spec/support/servers/checks/active/xss_dom.rb +50 -0
  335. data/spec/support/servers/checks/active/xss_dom_script_context.rb +53 -0
  336. data/spec/support/shared/browser/javascript/taint_tracer/sink/base.rb +6 -6
  337. data/spec/support/shared/check.rb +10 -12
  338. data/spec/support/shared/component/options/base.rb +24 -24
  339. data/spec/support/shared/element/base.rb +25 -25
  340. data/spec/support/shared/element/capabilities/auditable.rb +116 -140
  341. data/spec/support/shared/element/capabilities/dom_only.rb +65 -0
  342. data/spec/support/shared/element/capabilities/inputtable.rb +71 -86
  343. data/spec/support/shared/element/capabilities/mutable.rb +122 -111
  344. data/spec/support/shared/element/capabilities/refreshable.rb +10 -10
  345. data/spec/support/shared/element/capabilities/{submitable.rb → submittable.rb} +26 -26
  346. data/spec/support/shared/element/capabilities/with_auditor.rb +10 -10
  347. data/spec/support/shared/element/capabilities/with_dom.rb +8 -8
  348. data/spec/support/shared/element/capabilities/with_node.rb +4 -6
  349. data/spec/support/shared/element/capabilities/with_scope.rb +2 -2
  350. data/spec/support/shared/element/capabilities/with_source.rb +6 -8
  351. data/spec/support/shared/element/dom.rb +144 -0
  352. data/spec/support/shared/element/dom/auditable.rb +42 -0
  353. data/spec/support/shared/element/dom/inputtable.rb +5 -0
  354. data/spec/support/shared/element/dom/mutable.rb +3 -0
  355. data/spec/support/shared/element/dom/submittable.rb +119 -0
  356. data/spec/support/shared/external/wavsep.rb +3 -3
  357. data/spec/support/shared/fingerprinter.rb +2 -2
  358. data/spec/support/shared/framework.rb +1 -1
  359. data/spec/support/shared/http/message.rb +9 -9
  360. data/spec/support/shared/option_group.rb +17 -17
  361. data/spec/support/shared/path_extractor.rb +1 -1
  362. data/spec/support/shared/plugin.rb +2 -2
  363. data/spec/support/shared/support/cache.rb +57 -57
  364. data/spec/support/shared/support/lookup.rb +25 -25
  365. data/ui/cli/framework.rb +22 -11
  366. data/ui/cli/framework/option_parser.rb +15 -0
  367. data/ui/cli/option_parser.rb +8 -1
  368. data/ui/cli/output.rb +2 -1
  369. metadata +54 -20
  370. data/components/checks/active/xss_dom_inputs.rb +0 -236
  371. data/spec/components/checks/active/xss_dom_inputs_spec.rb +0 -30
  372. data/spec/support/servers/checks/active/xss_dom_inputs.rb +0 -59
  373. data/spec/support/shared/element/capabilities/auditable/dom.rb +0 -322
@@ -29,7 +29,7 @@ describe Arachni::UI::Output do
29
29
 
30
30
  it 'sends output to the logfile' do
31
31
  @out.print_line( 'blah' )
32
- IO.read( @logfile ).split( "\n" ).size == 1
32
+ expect(IO.read( @logfile ).split( "\n" ).size).to eq(1)
33
33
  end
34
34
  end
35
35
  end
@@ -5,14 +5,14 @@ describe 'Arachni::RPC::Server::Plugin::Manager' do
5
5
 
6
6
  describe '#available' do
7
7
  it 'returns an array of available plugins' do
8
- instance_spawn.plugins.available.should be_any
8
+ expect(instance_spawn.plugins.available).to be_any
9
9
  end
10
10
  end
11
11
 
12
12
  describe '#loaded' do
13
13
  context 'when there are loaded plugins' do
14
14
  it 'returns an empty array' do
15
- instance_spawn.plugins.loaded.should be_empty
15
+ expect(instance_spawn.plugins.loaded).to be_empty
16
16
  end
17
17
  end
18
18
  context 'when there are loaded plugins' do
@@ -20,7 +20,7 @@ describe 'Arachni::RPC::Server::Plugin::Manager' do
20
20
  plugins = instance_spawn.plugins
21
21
 
22
22
  plugins.load( { 'default' => {}} )
23
- plugins.loaded.should be_any
23
+ expect(plugins.loaded).to be_any
24
24
  end
25
25
  end
26
26
  end
@@ -30,7 +30,7 @@ describe 'Arachni::RPC::Server::Plugin::Manager' do
30
30
  plugins = instance_spawn.plugins
31
31
 
32
32
  plugins.load( { 'default' => {}} )
33
- plugins.loaded.should == ['default']
33
+ expect(plugins.loaded).to eq(['default'])
34
34
  end
35
35
 
36
36
  context 'with invalid options' do
@@ -41,7 +41,7 @@ describe 'Arachni::RPC::Server::Plugin::Manager' do
41
41
  rescue Exception
42
42
  raised = true
43
43
  end
44
- raised.should be_true
44
+ expect(raised).to be_truthy
45
45
  end
46
46
  end
47
47
  end
@@ -49,7 +49,7 @@ describe 'Arachni::RPC::Server::Plugin::Manager' do
49
49
  describe '#merge_results' do
50
50
  it "delegates to ##{Arachni::Data::Plugins}#merge_results" do
51
51
  plugins = Arachni::RPC::Server::Framework.new.plugins
52
- Arachni::Data.plugins.should receive(:merge_results)
52
+ expect(Arachni::Data.plugins).to receive(:merge_results)
53
53
  plugins.merge_results( [ distributable: { results: { stuff: 2 } } ] )
54
54
  end
55
55
  end
@@ -10,38 +10,38 @@ describe Array do
10
10
  context 'when passed' do
11
11
  context 'nil' do
12
12
  it 'returns false' do
13
- @arr.includes_tags?( nil ).should == false
13
+ expect(@arr.includes_tags?( nil )).to eq(false)
14
14
  end
15
15
  end
16
16
 
17
17
  context '[]' do
18
18
  it 'returns false' do
19
- @arr.includes_tags?( [] ).should == false
19
+ expect(@arr.includes_tags?( [] )).to eq(false)
20
20
  end
21
21
  end
22
22
 
23
23
  context String do
24
24
  context 'when includes the given tag (as either a String or a Symbol)' do
25
25
  it 'returns true' do
26
- [ 1 ].includes_tags?( 1 ).should == true
27
- [ :tag ].includes_tags?( :tag ).should == true
28
- [ :tag ].includes_tags?( 'tag' ).should == true
29
- %w(tag).includes_tags?( 'tag' ).should == true
30
- %w(tag).includes_tags?( :tag ).should == true
31
- [ :tag, 'tag' ].includes_tags?( :tag ).should == true
32
- [ :tag, 'tag' ].includes_tags?( 'tag' ).should == true
26
+ expect([ 1 ].includes_tags?( 1 )).to eq(true)
27
+ expect([ :tag ].includes_tags?( :tag )).to eq(true)
28
+ expect([ :tag ].includes_tags?( 'tag' )).to eq(true)
29
+ expect(%w(tag).includes_tags?( 'tag' )).to eq(true)
30
+ expect(%w(tag).includes_tags?( :tag )).to eq(true)
31
+ expect([ :tag, 'tag' ].includes_tags?( :tag )).to eq(true)
32
+ expect([ :tag, 'tag' ].includes_tags?( 'tag' )).to eq(true)
33
33
  end
34
34
  end
35
35
  context 'when it does not includes the given tag (as either a String or a Symbol)' do
36
36
  it 'returns false' do
37
- [ 1 ].includes_tags?( 2 ).should == false
38
- [ :tag ].includes_tags?( :tag1 ).should == false
39
- [ :tag ].includes_tags?( 'tag2' ).should == false
40
- %w(tag).includes_tags?( 'tag3' ).should == false
41
- %w(tag).includes_tags?( :tag5 ).should == false
42
- [ :tag, 'tag' ].includes_tags?( :ta5g ).should == false
43
- [ :tag, 'tag' ].includes_tags?( 'ta4g' ).should == false
44
- [ :t3ag, 'tag1' ].includes_tags?( 'tag' ).should == false
37
+ expect([ 1 ].includes_tags?( 2 )).to eq(false)
38
+ expect([ :tag ].includes_tags?( :tag1 )).to eq(false)
39
+ expect([ :tag ].includes_tags?( 'tag2' )).to eq(false)
40
+ expect(%w(tag).includes_tags?( 'tag3' )).to eq(false)
41
+ expect(%w(tag).includes_tags?( :tag5 )).to eq(false)
42
+ expect([ :tag, 'tag' ].includes_tags?( :ta5g )).to eq(false)
43
+ expect([ :tag, 'tag' ].includes_tags?( 'ta4g' )).to eq(false)
44
+ expect([ :t3ag, 'tag1' ].includes_tags?( 'tag' )).to eq(false)
45
45
  end
46
46
  end
47
47
  end
@@ -49,24 +49,24 @@ describe Array do
49
49
  context Array do
50
50
  context 'when includes any of the given tags (as either a String or a Symbol)' do
51
51
  it 'returns true' do
52
- [ 1, 2, 3 ].includes_tags?( [1] ).should == true
53
- [ :tag ].includes_tags?( [:tag] ).should == true
54
- [ :tag ].includes_tags?( ['tag', 12] ).should == true
55
- %w(tag).includes_tags?( ['tag', nil] ).should == true
56
- %w(tag).includes_tags?( [:tag] ).should == true
57
- [ :tag, 'tag' ].includes_tags?( [:tag] ).should == true
58
- [ :tag, 'tag' ].includes_tags?( ['tag', :blah] ).should == true
52
+ expect([ 1, 2, 3 ].includes_tags?( [1] )).to eq(true)
53
+ expect([ :tag ].includes_tags?( [:tag] )).to eq(true)
54
+ expect([ :tag ].includes_tags?( ['tag', 12] )).to eq(true)
55
+ expect(%w(tag).includes_tags?( ['tag', nil] )).to eq(true)
56
+ expect(%w(tag).includes_tags?( [:tag] )).to eq(true)
57
+ expect([ :tag, 'tag' ].includes_tags?( [:tag] )).to eq(true)
58
+ expect([ :tag, 'tag' ].includes_tags?( ['tag', :blah] )).to eq(true)
59
59
  end
60
60
  end
61
61
  context 'when it does not include any of the given tags (as either a String or a Symbol)' do
62
62
  it 'returns true' do
63
- [ 1, 2, 3 ].includes_tags?( [4, 5] ).should == false
64
- [ :tag ].includes_tags?( [:ta3g] ).should == false
65
- [ :tag ].includes_tags?( ['ta3g', 12] ).should == false
66
- %w(tag).includes_tags?( ['ta3g', nil] ).should == false
67
- %w(tag).includes_tags?( [:t4ag] ).should == false
68
- [ :tag, 'tag' ].includes_tags?( [:t3ag] ).should == false
69
- [ :tag, 'tag' ].includes_tags?( ['t2ag', :b3lah] ).should == false
63
+ expect([ 1, 2, 3 ].includes_tags?( [4, 5] )).to eq(false)
64
+ expect([ :tag ].includes_tags?( [:ta3g] )).to eq(false)
65
+ expect([ :tag ].includes_tags?( ['ta3g', 12] )).to eq(false)
66
+ expect(%w(tag).includes_tags?( ['ta3g', nil] )).to eq(false)
67
+ expect(%w(tag).includes_tags?( [:t4ag] )).to eq(false)
68
+ expect([ :tag, 'tag' ].includes_tags?( [:t3ag] )).to eq(false)
69
+ expect([ :tag, 'tag' ].includes_tags?( ['t2ag', :b3lah] )).to eq(false)
70
70
  end
71
71
  end
72
72
  end
@@ -79,33 +79,33 @@ describe Array do
79
79
  "\xE2\x9C\x93",
80
80
  [ "\xE2\x9C\x93" ]
81
81
  ].recode
82
- recoded.first.should == "\u2713"
83
- recoded.last.should == ["\u2713"]
82
+ expect(recoded.first).to eq("\u2713")
83
+ expect(recoded.last).to eq(["\u2713"])
84
84
  end
85
85
  end
86
86
 
87
87
  describe '#chunk' do
88
88
  it 'splits the array into chunks' do
89
89
  chunks = @arr.chunk( 5 )
90
- chunks.size.should == 5
91
- chunks.each { |c| c.size.should == 10 }
90
+ expect(chunks.size).to eq(5)
91
+ chunks.each { |c| expect(c.size).to eq(10) }
92
92
 
93
93
  chunks = @arr.chunk( 3 )
94
- chunks.size.should == 3
94
+ expect(chunks.size).to eq(3)
95
95
 
96
- chunks[0].size.should == 17
97
- chunks[1].size.should == 17
98
- chunks[2].size.should == 16
96
+ expect(chunks[0].size).to eq(17)
97
+ expect(chunks[1].size).to eq(17)
98
+ expect(chunks[2].size).to eq(16)
99
99
  end
100
100
 
101
101
  context 'when called without params' do
102
102
  it 'splits the array into 2 chunks' do
103
103
  chunks = @arr.chunk
104
- chunks.size.should == 2
104
+ expect(chunks.size).to eq(2)
105
105
 
106
106
  24.times do |i|
107
- chunks.first[i].should == i
108
- chunks.last[i].should == i + 25
107
+ expect(chunks.first[i]).to eq(i)
108
+ expect(chunks.last[i]).to eq(i + 25)
109
109
  end
110
110
  end
111
111
  end
@@ -25,38 +25,38 @@ describe Hash do
25
25
 
26
26
  describe '#my_stringify_keys' do
27
27
  it 'recursively converts keys to strings' do
28
- with_symbols.my_stringify_keys.should == with_strings
28
+ expect(with_symbols.my_stringify_keys).to eq(with_strings)
29
29
  end
30
30
 
31
31
  context 'when the recursive is set to false' do
32
32
  it 'only converts the keys at depth 1' do
33
- with_symbols.my_stringify_keys( false ).should == {
33
+ expect(with_symbols.my_stringify_keys( false )).to eq({
34
34
  'stuff' => 'blah',
35
35
  'more' => {
36
36
  stuff: {
37
37
  blah: 'stuff'
38
38
  }
39
39
  }
40
- }
40
+ })
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
45
  describe '#my_symbolize_keys' do
46
46
  it 'recursively converts keys to symbols' do
47
- with_strings.my_symbolize_keys.should == with_symbols
47
+ expect(with_strings.my_symbolize_keys).to eq(with_symbols)
48
48
  end
49
49
 
50
50
  context 'when the recursive is set to false' do
51
51
  it 'only converts the keys at depth 1' do
52
- with_strings.my_symbolize_keys( false ).should == {
52
+ expect(with_strings.my_symbolize_keys( false )).to eq({
53
53
  stuff: 'blah',
54
54
  more: {
55
55
  'stuff' => {
56
56
  'blah' => 'stuff'
57
57
  }
58
58
  }
59
- }
59
+ })
60
60
  end
61
61
  end
62
62
  end
@@ -65,29 +65,29 @@ describe Hash do
65
65
  it 'converts keys and values to frozen strings' do
66
66
  converted = with_symbols.stringify_recursively_and_freeze
67
67
 
68
- converted.should == with_strings
69
- converted.keys.map(&:frozen?).uniq.should == [true]
70
- converted.values.map(&:frozen?).uniq.should == [true]
68
+ expect(converted).to eq(with_strings)
69
+ expect(converted.keys.map(&:frozen?).uniq).to eq([true])
70
+ expect(converted.values.map(&:frozen?).uniq).to eq([true])
71
71
  end
72
72
 
73
73
  it 'returns a frozen hash' do
74
- with_symbols.stringify_recursively_and_freeze.should be_frozen
74
+ expect(with_symbols.stringify_recursively_and_freeze).to be_frozen
75
75
  end
76
76
  end
77
77
 
78
78
  describe '#my_stringify' do
79
79
  it 'returns a Hash with keys and values recursively converted to strings' do
80
- {
80
+ expect({
81
81
  test: 'blah',
82
82
  another_hash: {
83
83
  stuff: 'test'
84
84
  }
85
- }.my_stringify.should == {
85
+ }.my_stringify).to eq({
86
86
  'test' => 'blah',
87
87
  'another_hash' => {
88
88
  'stuff' => 'test'
89
89
  }
90
- }
90
+ })
91
91
  end
92
92
  end
93
93
 
@@ -99,29 +99,31 @@ describe Hash do
99
99
  blah3: "\xE2\x9C\x93"
100
100
  }
101
101
  }.recode
102
- recoded[:blah].should == "\u2713"
103
- recoded[:blah2][:blah3].should == "\u2713"
102
+ expect(recoded[:blah]).to eq("\u2713")
103
+ expect(recoded[:blah2][:blah3]).to eq("\u2713")
104
104
  end
105
105
  end
106
106
 
107
107
  describe '#downcase' do
108
108
  it 'converts keys and values to lower-case strings' do
109
- { Stuff: 'VaLue', 'BlAh' => 'VaLUe 2' }.downcase.should ==
109
+ expect({ Stuff: 'VaLue', 'BlAh' => 'VaLUe 2' }.downcase).to eq(
110
110
  { 'stuff' => 'value', 'blah' => 'value 2' }
111
+ )
111
112
  end
112
113
  end
113
114
 
114
115
  describe '#find_symbol_keys_recursively' do
115
116
  it 'returns all symbol keys from self and children hashes' do
116
- {
117
+ expect({
117
118
  stuff: 'VaLue',
118
119
  stuff2: {
119
120
  stuff3: {
120
121
  stuff4: 'Blah'
121
122
  }
122
123
  }
123
- }.find_symbol_keys_recursively.sort.should ==
124
+ }.find_symbol_keys_recursively.sort).to eq(
124
125
  [:stuff, :stuff2, :stuff3, :stuff4].sort
126
+ )
125
127
  end
126
128
  end
127
129
  end
@@ -14,12 +14,12 @@ describe IO do
14
14
  EOSTR
15
15
  f.flush
16
16
 
17
- f.tail( 4 ).should == [
17
+ expect(f.tail( 4 )).to eq([
18
18
  ' Test2',
19
19
  ' Test3',
20
20
  ' Test4',
21
21
  ' Test5'
22
- ]
22
+ ])
23
23
  end
24
24
  end
25
25
  end
@@ -15,7 +15,7 @@ describe Object do
15
15
  b = a.deep_clone
16
16
  a[0] << 3
17
17
 
18
- b.should == [ [1,2] ]
18
+ expect(b).to eq([ [1,2] ])
19
19
  end
20
20
  end
21
21
 
@@ -6,9 +6,9 @@ describe Set do
6
6
  it 'removes and returns an item from the set' do
7
7
  set = described_class.new
8
8
  set << 1
9
- set.size.should == 1
10
- set.shift.should == 1
11
- set.size.should == 0
9
+ expect(set.size).to eq(1)
10
+ expect(set.shift).to eq(1)
11
+ expect(set.size).to eq(0)
12
12
  end
13
13
  end
14
14
 
@@ -28,17 +28,17 @@ describe String do
28
28
 
29
29
  describe '#scan_in_groups' do
30
30
  it 'returns regexp matches in named groups' do
31
- path.scan_in_groups( regex_with_names ).should == {
31
+ expect(path.scan_in_groups( regex_with_names )).to eq({
32
32
  'category' => 'book',
33
33
  'book-id' => '12',
34
34
  'chapter-id' => '3',
35
35
  'stuff-id' => '4'
36
- }
36
+ })
37
37
  end
38
38
 
39
39
  context 'when there are no matches' do
40
40
  it 'returns an empty hash' do
41
- 'test'.scan_in_groups( regex_with_names ).should == {}
41
+ expect('test'.scan_in_groups( regex_with_names )).to eq({})
42
42
  end
43
43
  end
44
44
 
@@ -51,10 +51,10 @@ describe String do
51
51
 
52
52
  describe '#sub_in_groups' do
53
53
  it 'substitutes the named matches' do
54
- path.sub_in_groups(
54
+ expect(path.sub_in_groups(
55
55
  regex_with_names,
56
56
  grouped_substitutions
57
- ).should == '/new-category/new-book-id/blahahaha/test/chapter-new-chapter-id/stuff-new-stuff-id/12'
57
+ )).to eq('/new-category/new-book-id/blahahaha/test/chapter-new-chapter-id/stuff-new-stuff-id/12')
58
58
  end
59
59
 
60
60
  context 'when using invalid group names' do
@@ -71,7 +71,7 @@ describe String do
71
71
  describe '#sub_in_groups!' do
72
72
  it 'substitutes the named matches in place' do
73
73
  path.sub_in_groups!( regex_with_names, grouped_substitutions )
74
- path.should == '/new-category/new-book-id/blahahaha/test/chapter-new-chapter-id/stuff-new-stuff-id/12'
74
+ expect(path).to eq('/new-category/new-book-id/blahahaha/test/chapter-new-chapter-id/stuff-new-stuff-id/12')
75
75
  end
76
76
 
77
77
  context 'when using invalid group names' do
@@ -99,36 +99,36 @@ describe String do
99
99
  Boo-Yah!
100
100
  END
101
101
 
102
- str.rdiff( str2 ).should == " This is the test.\n" +
103
- ' Not really sure what else to put here'
102
+ expect(str.rdiff( str2 )).to eq(" This is the test.\n" +
103
+ ' Not really sure what else to put here')
104
104
  end
105
105
  end
106
106
 
107
107
  describe '#diff_ratio' do
108
108
  context 'when the strings are identical' do
109
109
  it 'returns 0.0' do
110
- ''.diff_ratio( '' ).should == 0
111
- 'test'.diff_ratio( 'test' ).should == 0
112
- 'test this'.diff_ratio( 'test this' ).should == 0
110
+ expect(''.diff_ratio( '' )).to eq(0)
111
+ expect('test'.diff_ratio( 'test' )).to eq(0)
112
+ expect('test this'.diff_ratio( 'test this' )).to eq(0)
113
113
  end
114
114
  end
115
115
  context 'when the strings completely different' do
116
116
  it 'returns 1.0' do
117
- ''.diff_ratio( 'toast' ).should == 1
118
- 'test'.diff_ratio( 'toast' ).should == 1
119
- 'test this'.diff_ratio( 'toast that' ).should == 1
117
+ expect(''.diff_ratio( 'toast' )).to eq(1)
118
+ expect('test'.diff_ratio( 'toast' )).to eq(1)
119
+ expect('test this'.diff_ratio( 'toast that' )).to eq(1)
120
120
  end
121
121
  end
122
122
  context 'when the strings share less than half of their words' do
123
123
  it 'returns < 0.5' do
124
- 'test this here now'.diff_ratio( 'test that here now' ).should > 0.0
125
- 'test this here now'.diff_ratio( 'test that here now' ).should < 0.5
124
+ expect('test this here now'.diff_ratio( 'test that here now' )).to be > 0.0
125
+ expect('test this here now'.diff_ratio( 'test that here now' )).to be < 0.5
126
126
  end
127
127
  end
128
128
  context 'when the strings share more than half of their words' do
129
129
  it 'returns > 0.5' do
130
- 'test this here now'.diff_ratio( 'test that here later' ).should > 0.0
131
- 'test this here now'.diff_ratio( 'test that here later' ).should > 0.5
130
+ expect('test this here now'.diff_ratio( 'test that here later' )).to be > 0.0
131
+ expect('test this here now'.diff_ratio( 'test that here later' )).to be > 0.5
132
132
  end
133
133
  end
134
134
  end
@@ -136,17 +136,17 @@ describe String do
136
136
  describe '#words' do
137
137
  context 'when strict is set to true' do
138
138
  it 'does not include boundaries' do
139
- 'blah.bloo<ha hoo'.words( true ).sort.should == %w(blah bloo ha hoo).sort
139
+ expect('blah.bloo<ha hoo'.words( true ).sort).to eq(%w(blah bloo ha hoo).sort)
140
140
  end
141
141
  end
142
142
  context 'when strict is set to false' do
143
143
  it 'includes boundaries' do
144
- 'blah.bloo<ha hoo'.words( false ).sort.should == [" ", ".", "<", "blah", "bloo", "ha", "hoo"] .sort
144
+ expect('blah.bloo<ha hoo'.words( false ).sort).to eq([" ", ".", "<", "blah", "bloo", "ha", "hoo"] .sort)
145
145
  end
146
146
  end
147
147
  context 'when strict is not specified' do
148
148
  it 'defaults to false' do
149
- 'blah.bloo<ha hoo'.words.sort.should == 'blah.bloo<ha hoo'.words( false ).sort
149
+ expect('blah.bloo<ha hoo'.words.sort).to eq('blah.bloo<ha hoo'.words( false ).sort)
150
150
  end
151
151
  end
152
152
  end
@@ -156,7 +156,7 @@ describe String do
156
156
 
157
157
  it 'removes invalid characters' do
158
158
  subject.recode!
159
- subject.should == "abcあ�"
159
+ expect(subject).to eq("abcあ�")
160
160
  end
161
161
  end
162
162
 
@@ -164,23 +164,23 @@ describe String do
164
164
  subject { "abc\u3042\x81" }
165
165
 
166
166
  it 'returns a copy of the String without invalid characters' do
167
- subject.recode.should == "abcあ�"
167
+ expect(subject.recode).to eq("abcあ�")
168
168
  end
169
169
  end
170
170
 
171
171
  describe '#persistent_hash' do
172
172
  it 'returns an Integer' do
173
- 'test'.persistent_hash.should be_kind_of Integer
173
+ expect('test'.persistent_hash).to be_kind_of Integer
174
174
  end
175
175
 
176
176
  context 'when two strings are equal' do
177
177
  it 'returns equal values' do
178
- 'test'.persistent_hash.should == 'test'.persistent_hash
178
+ expect('test'.persistent_hash).to eq('test'.persistent_hash)
179
179
  end
180
180
  end
181
181
  context 'when two strings are not equal' do
182
182
  it 'returns different values' do
183
- 'test'.persistent_hash.should_not == 'testa'.persistent_hash
183
+ expect('test'.persistent_hash).not_to eq('testa'.persistent_hash)
184
184
  end
185
185
  end
186
186
  end
@@ -189,12 +189,12 @@ describe String do
189
189
  context 'when the content is' do
190
190
  context 'binary' do
191
191
  it 'returns true' do
192
- "\ff\ff\ff".binary?.should be_true
192
+ expect("\ff\ff\ff".binary?).to be_truthy
193
193
  end
194
194
  end
195
195
  context 'text' do
196
196
  it 'returns false' do
197
- 'test'.binary?.should be_false
197
+ expect('test'.binary?).to be_falsey
198
198
  end
199
199
  end
200
200
  end
@@ -202,13 +202,13 @@ describe String do
202
202
 
203
203
  describe '#longest_word' do
204
204
  it 'returns the longest word' do
205
- 'o tw longest'.longest_word.should == 'longest'
205
+ expect('o tw longest'.longest_word).to eq('longest')
206
206
  end
207
207
  end
208
208
 
209
209
  describe '#shortest_word' do
210
210
  it 'returns the longest word' do
211
- 'o tw longest'.shortest_word.should == 'o'
211
+ expect('o tw longest'.shortest_word).to eq('o')
212
212
  end
213
213
  end
214
214
  end