arachni 1.2.1 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/Gemfile +1 -1
- data/README.md +16 -5
- data/components/checks/active/ldap_injection/errors.txt +1 -0
- data/components/checks/active/source_code_disclosure.rb +1 -1
- data/components/checks/active/unvalidated_redirect.rb +6 -6
- data/components/checks/active/unvalidated_redirect_dom.rb +10 -7
- data/components/checks/passive/grep/captcha.rb +14 -5
- data/components/checks/passive/grep/form_upload.rb +7 -3
- data/components/checks/passive/grep/hsts.rb +3 -3
- data/components/checks/passive/grep/html_objects.rb +2 -3
- data/components/checks/passive/grep/http_only_cookies.rb +2 -3
- data/components/checks/passive/grep/insecure_cookies.rb +1 -1
- data/components/checks/passive/grep/password_autocomplete.rb +2 -2
- data/components/checks/passive/grep/unencrypted_password_forms.rb +7 -7
- data/components/checks/passive/grep/x_frame_options.rb +2 -2
- data/components/checks/passive/http_put.rb +2 -3
- data/components/path_extractors/comments.rb +3 -3
- data/components/path_extractors/scripts.rb +10 -1
- data/components/plugins/defaults/autothrottle.rb +27 -18
- data/components/plugins/defaults/meta/remedies/discovery.rb +30 -33
- data/components/plugins/defaults/meta/remedies/timing_attacks.rb +7 -11
- data/components/plugins/login_script.rb +9 -3
- data/components/plugins/proxy.rb +4 -3
- data/components/reporters/html.rb +11 -14
- data/components/reporters/html/default/issue.erb +13 -38
- data/components/reporters/html/default/issue/info.erb +1 -1
- data/components/reporters/html/default/summary/issues/by_name.erb +3 -3
- data/components/reporters/stdout.rb +62 -71
- data/components/reporters/xml.rb +26 -40
- data/components/reporters/xml/schema.xsd +43 -89
- data/lib/arachni/browser.rb +52 -3
- data/lib/arachni/browser/javascript.rb +3 -3
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -25
- data/lib/arachni/browser_cluster.rb +61 -0
- data/lib/arachni/browser_cluster/job.rb +21 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +3 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration/event_trigger.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +3 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +5 -0
- data/lib/arachni/check/auditor.rb +22 -12
- data/lib/arachni/data/framework.rb +13 -1
- data/lib/arachni/data/issues.rb +9 -25
- data/lib/arachni/element/base.rb +9 -3
- data/lib/arachni/element/capabilities/analyzable.rb +2 -6
- data/lib/arachni/element/capabilities/analyzable/differential.rb +24 -7
- data/lib/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +23 -23
- data/lib/arachni/element/capabilities/auditable.rb +0 -6
- data/lib/arachni/element/capabilities/dom_only.rb +61 -0
- data/lib/arachni/element/capabilities/with_dom.rb +3 -1
- data/lib/arachni/element/cookie.rb +35 -5
- data/lib/arachni/element/cookie/dom.rb +13 -4
- data/lib/arachni/element/{capabilities/auditable/dom.rb → dom.rb} +20 -68
- data/lib/arachni/element/dom/capabilities/auditable.rb +29 -0
- data/lib/arachni/element/dom/capabilities/inputtable.rb +27 -0
- data/lib/arachni/element/dom/capabilities/mutable.rb +21 -0
- data/lib/arachni/element/dom/capabilities/submittable.rb +52 -0
- data/lib/arachni/element/form.rb +12 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +2 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/form/dom.rb +9 -3
- data/lib/arachni/element/header.rb +14 -33
- data/lib/arachni/element/header/capabilities/inputtable.rb +29 -0
- data/lib/arachni/element/header/capabilities/mutable.rb +51 -0
- data/lib/arachni/element/input/dom.rb +71 -0
- data/lib/arachni/element/json.rb +2 -0
- data/lib/arachni/element/link.rb +3 -0
- data/lib/arachni/element/link/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link/dom.rb +16 -3
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/link_template.rb +3 -5
- data/lib/arachni/element/link_template/capabilities/inputtable.rb +5 -0
- data/lib/arachni/element/link_template/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link_template/dom.rb +16 -3
- data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/server.rb +3 -5
- data/lib/arachni/element/ui_form.rb +106 -0
- data/lib/arachni/element/ui_form/dom.rb +107 -0
- data/lib/arachni/element/ui_input.rb +62 -0
- data/lib/arachni/element/xml.rb +2 -1
- data/lib/arachni/framework.rb +7 -5
- data/lib/arachni/framework/parts/audit.rb +0 -1
- data/lib/arachni/framework/parts/check.rb +1 -0
- data/lib/arachni/framework/parts/data.rb +4 -0
- data/lib/arachni/framework/parts/state.rb +0 -2
- data/lib/arachni/http/client.rb +17 -6
- data/lib/arachni/http/proxy_server.rb +52 -5
- data/lib/arachni/http/request.rb +1 -1
- data/lib/arachni/issue.rb +34 -179
- data/lib/arachni/issue/severity.rb +2 -0
- data/lib/arachni/option_groups/audit.rb +22 -2
- data/lib/arachni/option_groups/browser_cluster.rb +15 -0
- data/lib/arachni/page.rb +3 -2
- data/lib/arachni/parser.rb +24 -5
- data/lib/arachni/platform/manager.rb +1 -2
- data/lib/arachni/rpc/server/framework.rb +3 -4
- data/lib/arachni/rpc/server/framework/multi_instance.rb +2 -1
- data/lib/arachni/session.rb +1 -1
- data/lib/arachni/trainer.rb +4 -7
- data/lib/arachni/watir/element.rb +12 -1
- data/lib/version +1 -1
- data/spec/arachni/browser/element_locator_spec.rb +43 -43
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +44 -44
- data/spec/arachni/browser/javascript/proxy/stub_spec.rb +17 -14
- data/spec/arachni/browser/javascript/proxy_spec.rb +24 -24
- data/spec/arachni/browser/javascript/taint_tracer/frame/called_function_spec.rb +11 -11
- data/spec/arachni/browser/javascript/taint_tracer/frame_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer/sink/data_flow_spec.rb +13 -13
- data/spec/arachni/browser/javascript/taint_tracer/sink/execution_flow_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +568 -558
- data/spec/arachni/browser/javascript_spec.rb +73 -63
- data/spec/arachni/browser_cluster/job/result_spec.rb +3 -3
- data/spec/arachni/browser_cluster/job_spec.rb +68 -48
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger_spec.rb +5 -4
- data/spec/arachni/browser_cluster/jobs/resource_exploration/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration_spec.rb +5 -5
- data/spec/arachni/browser_cluster/worker_spec.rb +87 -70
- data/spec/arachni/browser_cluster_spec.rb +64 -39
- data/spec/arachni/browser_spec.rb +692 -527
- data/spec/arachni/check/auditor_spec.rb +177 -147
- data/spec/arachni/check/base_spec.rb +33 -33
- data/spec/arachni/check/manager_spec.rb +15 -15
- data/spec/arachni/component/base_spec.rb +8 -8
- data/spec/arachni/component/manager_spec.rb +100 -99
- data/spec/arachni/component/options/address_spec.rb +3 -3
- data/spec/arachni/component/options/base_spec.rb +7 -7
- data/spec/arachni/component/options/bool_spec.rb +9 -9
- data/spec/arachni/component/options/float_spec.rb +6 -6
- data/spec/arachni/component/options/int_spec.rb +5 -5
- data/spec/arachni/component/options/multiple_choice_spec.rb +12 -12
- data/spec/arachni/component/options/object_spec.rb +2 -2
- data/spec/arachni/component/options/path_spec.rb +3 -3
- data/spec/arachni/component/options/port_spec.rb +5 -5
- data/spec/arachni/component/options/string_spec.rb +3 -3
- data/spec/arachni/component/options/url_spec.rb +4 -4
- data/spec/arachni/component/utilities_spec.rb +2 -2
- data/spec/arachni/data/framework/rpc_spec.rb +10 -9
- data/spec/arachni/data/framework_spec.rb +65 -46
- data/spec/arachni/data/issues_spec.rb +39 -77
- data/spec/arachni/data/plugins_spec.rb +11 -11
- data/spec/arachni/data/session_spec.rb +6 -6
- data/spec/arachni/data_spec.rb +8 -8
- data/spec/arachni/element/body_spec.rb +10 -10
- data/spec/arachni/element/capabilities/analyzable/differential_spec.rb +39 -21
- data/spec/arachni/element/capabilities/analyzable/{taint_spec.rb → signature_spec.rb} +63 -63
- data/spec/arachni/element/capabilities/analyzable/timeout_spec.rb +51 -51
- data/spec/arachni/element/capabilities/with_scope/scope_spec.rb +5 -5
- data/spec/arachni/element/cookie/dom_spec.rb +37 -18
- data/spec/arachni/element/cookie_spec.rb +206 -139
- data/spec/arachni/element/form/dom_spec.rb +36 -19
- data/spec/arachni/element/form_spec.rb +210 -187
- data/spec/arachni/element/generic_dom_spec.rb +14 -14
- data/spec/arachni/element/header_spec.rb +35 -17
- data/spec/arachni/element/json_spec.rb +53 -31
- data/spec/arachni/element/link/dom_spec.rb +46 -28
- data/spec/arachni/element/link_spec.rb +58 -40
- data/spec/arachni/element/link_template/dom_spec.rb +47 -29
- data/spec/arachni/element/link_template_spec.rb +79 -61
- data/spec/arachni/element/path_spec.rb +1 -1
- data/spec/arachni/element/server_spec.rb +33 -32
- data/spec/arachni/element/ui_form/ui_form_dom_spec.rb +164 -0
- data/spec/arachni/element/ui_form_spec.rb +242 -0
- data/spec/arachni/element/ui_input/dom_spec.rb +157 -0
- data/spec/arachni/element/ui_input_spec.rb +136 -0
- data/spec/arachni/element/xml_spec.rb +42 -24
- data/spec/arachni/element_filter_spec.rb +49 -48
- data/spec/arachni/error_spec.rb +3 -3
- data/spec/arachni/framework/parts/audit_spec.rb +64 -63
- data/spec/arachni/framework/parts/browser_spec.rb +16 -16
- data/spec/arachni/framework/parts/check_spec.rb +3 -3
- data/spec/arachni/framework/parts/data_spec.rb +48 -48
- data/spec/arachni/framework/parts/platform_spec.rb +3 -3
- data/spec/arachni/framework/parts/plugin_spec.rb +7 -6
- data/spec/arachni/framework/parts/report_spec.rb +7 -7
- data/spec/arachni/framework/parts/scope_spec.rb +16 -16
- data/spec/arachni/framework/parts/state_spec.rb +68 -69
- data/spec/arachni/framework_spec.rb +39 -31
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +32 -32
- data/spec/arachni/http/client_spec.rb +219 -208
- data/spec/arachni/http/cookie_jar_spec.rb +72 -72
- data/spec/arachni/http/headers_spec.rb +14 -14
- data/spec/arachni/http/proxy_server_spec.rb +43 -42
- data/spec/arachni/http/request_spec.rb +105 -103
- data/spec/arachni/http/response/scope_spec.rb +24 -24
- data/spec/arachni/http/response_spec.rb +50 -49
- data/spec/arachni/issue/severity_spec.rb +10 -9
- data/spec/arachni/issue_spec.rb +71 -369
- data/spec/arachni/option_groups/audit_spec.rb +114 -114
- data/spec/arachni/option_groups/browser_cluster_spec.rb +20 -3
- data/spec/arachni/option_groups/datastore_spec.rb +6 -6
- data/spec/arachni/option_groups/dispatcher_spec.rb +19 -19
- data/spec/arachni/option_groups/http_spec.rb +11 -11
- data/spec/arachni/option_groups/input_spec.rb +31 -27
- data/spec/arachni/option_groups/output_spec.rb +2 -2
- data/spec/arachni/option_groups/paths_spec.rb +17 -17
- data/spec/arachni/option_groups/rpc_spec.rb +2 -2
- data/spec/arachni/option_groups/scope_spec.rb +40 -40
- data/spec/arachni/option_groups/session_spec.rb +6 -5
- data/spec/arachni/option_groups/snapshot_spec.rb +4 -4
- data/spec/arachni/options_spec.rb +46 -45
- data/spec/arachni/page/dom/transition_spec.rb +74 -72
- data/spec/arachni/page/dom_spec.rb +35 -35
- data/spec/arachni/page/scope_spec.rb +15 -15
- data/spec/arachni/page_spec.rb +217 -217
- data/spec/arachni/parser_spec.rb +106 -104
- data/spec/arachni/platform/fingerprinter_spec.rb +17 -14
- data/spec/arachni/platform/list_spec.rb +33 -33
- data/spec/arachni/platform/manager_spec.rb +67 -64
- data/spec/arachni/plugin/base_spec.rb +10 -10
- data/spec/arachni/plugin/manager_spec.rb +38 -37
- data/spec/arachni/report_spec.rb +43 -40
- data/spec/arachni/reporter/base_spec.rb +15 -15
- data/spec/arachni/reporter/manager_spec.rb +4 -4
- data/spec/arachni/reporter/options_spec.rb +6 -6
- data/spec/arachni/rpc/client/base_spec.rb +6 -6
- data/spec/arachni/rpc/client/dispatcher_spec.rb +2 -2
- data/spec/arachni/rpc/client/instance_spec.rb +6 -6
- data/spec/arachni/rpc/server/active_options_spec.rb +11 -8
- data/spec/arachni/rpc/server/base_spec.rb +5 -5
- data/spec/arachni/rpc/server/checks/manager_spec.rb +8 -8
- data/spec/arachni/rpc/server/dispatcher/node_spec.rb +37 -37
- data/spec/arachni/rpc/server/dispatcher/service_spec.rb +15 -14
- data/spec/arachni/rpc/server/dispatcher_spec.rb +36 -35
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +36 -36
- data/spec/arachni/rpc/server/framework_multi_spec.rb +340 -336
- data/spec/arachni/rpc/server/framework_spec.rb +90 -85
- data/spec/arachni/rpc/server/instance_spec.rb +126 -107
- data/spec/arachni/rpc/server/output_spec.rb +1 -1
- data/spec/arachni/rpc/server/plugin/manager_spec.rb +6 -6
- data/spec/arachni/ruby/array_spec.rb +42 -42
- data/spec/arachni/ruby/hash_spec.rb +20 -18
- data/spec/arachni/ruby/io_spec.rb +2 -2
- data/spec/arachni/ruby/object_spec.rb +1 -1
- data/spec/arachni/ruby/set_spec.rb +3 -3
- data/spec/arachni/ruby/string_spec.rb +30 -30
- data/spec/arachni/ruby/webrick_spec.rb +2 -2
- data/spec/arachni/scope_spec.rb +1 -1
- data/spec/arachni/session_spec.rb +67 -64
- data/spec/arachni/snapshot_spec.rb +15 -15
- data/spec/arachni/state/audit_spec.rb +11 -11
- data/spec/arachni/state/element_filter_spec.rb +6 -6
- data/spec/arachni/state/framework/rpc_spec.rb +12 -12
- data/spec/arachni/state/framework_spec.rb +125 -121
- data/spec/arachni/state/http_spec.rb +7 -7
- data/spec/arachni/state/options_spec.rb +7 -7
- data/spec/arachni/state/plugins_spec.rb +8 -8
- data/spec/arachni/state_spec.rb +10 -10
- data/spec/arachni/support/buffer/autoflush_spec.rb +16 -16
- data/spec/arachni/support/buffer/base_spec.rb +39 -39
- data/spec/arachni/support/cache/least_cost_replacement_spec.rb +18 -18
- data/spec/arachni/support/cache/least_recently_pushed_spec.rb +24 -24
- data/spec/arachni/support/cache/least_recently_used_spec.rb +20 -20
- data/spec/arachni/support/cache/preference_spec.rb +4 -4
- data/spec/arachni/support/cache/random_replacement_spec.rb +8 -8
- data/spec/arachni/support/crypto/rsa_aes_cbc_spec.rb +1 -1
- data/spec/arachni/support/database/hash_spec.rb +44 -43
- data/spec/arachni/support/database/queue_spec.rb +27 -27
- data/spec/arachni/support/lookup/hash_set_spec.rb +8 -8
- data/spec/arachni/support/lookup/moolb_spec.rb +3 -3
- data/spec/arachni/support/mixins/observable_spec.rb +6 -6
- data/spec/arachni/support/signature_spec.rb +19 -19
- data/spec/arachni/trainer_spec.rb +39 -39
- data/spec/arachni/typhoeus/hydra_spec.rb +2 -2
- data/spec/arachni/uri/scope_spec.rb +66 -66
- data/spec/arachni/uri_spec.rb +107 -105
- data/spec/arachni/utilities_spec.rb +40 -40
- data/spec/components/checks/active/csrf_spec.rb +8 -8
- data/spec/components/checks/active/no_sql_injection_spec.rb +1 -1
- data/spec/components/checks/active/sql_injection_spec.rb +16 -16
- data/spec/components/checks/active/trainer_spec.rb +4 -4
- data/spec/components/checks/active/unvalidated_redirect_dom_spec.rb +4 -2
- data/spec/components/checks/active/xpath_injection_spec.rb +1 -1
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +51 -21
- data/spec/components/checks/active/xss_dom_spec.rb +46 -24
- data/spec/components/checks/passive/allowed_methods_spec.rb +1 -1
- data/spec/components/checks/passive/grep/cookie_set_for_parent_domain_spec.rb +1 -1
- data/spec/components/checks/passive/grep/hsts_spec.rb +2 -2
- data/spec/components/checks/passive/grep/http_only_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cors_policy_spec.rb +2 -2
- data/spec/components/checks/passive/grep/password_autocomplete_spec.rb +1 -1
- data/spec/components/checks/passive/grep/private_ip_spec.rb +3 -3
- data/spec/components/checks/passive/grep/unencrypted_password_forms_spec.rb +1 -1
- data/spec/components/checks/passive/grep/x_frame_options_spec.rb +2 -2
- data/spec/components/checks/passive/interesting_responses_spec.rb +2 -2
- data/spec/components/checks/passive/webdav_spec.rb +1 -1
- data/spec/components/checks/passive/xst_spec.rb +1 -1
- data/spec/components/fingerprinters/servers/apache_spec.rb +2 -2
- data/spec/components/path_extractors/comments_spec.rb +5 -1
- data/spec/components/path_extractors/scripts_spec.rb +5 -2
- data/spec/components/plugins/autologin_spec.rb +22 -22
- data/spec/components/plugins/autothrottle_spec.rb +6 -5
- data/spec/components/plugins/content_types_spec.rb +4 -4
- data/spec/components/plugins/cookie_collector_spec.rb +5 -5
- data/spec/components/plugins/exec_spec.rb +12 -12
- data/spec/components/plugins/form_dicattack_spec.rb +3 -3
- data/spec/components/plugins/headers_collector_spec.rb +8 -8
- data/spec/components/plugins/healthmap_spec.rb +3 -3
- data/spec/components/plugins/http_dicattack_spec.rb +3 -3
- data/spec/components/plugins/login_script_spec.rb +79 -22
- data/spec/components/plugins/meta/remedies/discovery_spec.rb +3 -2
- data/spec/components/plugins/meta/remedies/timing_attacks_spec.rb +3 -3
- data/spec/components/plugins/meta/uniformity_spec.rb +2 -2
- data/spec/components/plugins/restrict_to_dom_state_spec.rb +1 -1
- data/spec/components/plugins/script_spec.rb +1 -1
- data/spec/components/plugins/uncommon_headers_spec.rb +2 -2
- data/spec/components/plugins/vector_collector_spec.rb +2 -2
- data/spec/components/plugins/vector_feed_spec.rb +40 -40
- data/spec/components/plugins/waf_detector_spec.rb +6 -6
- data/spec/components/reporters/json_spec.rb +4 -4
- data/spec/components/reporters/marshal_spec.rb +2 -2
- data/spec/components/reporters/yaml_spec.rb +3 -2
- data/spec/external/wavsep/active/sqli_spec.rb +1 -3
- data/spec/spec_helper.rb +4 -0
- data/spec/support/factories/element/ui_form.rb +14 -0
- data/spec/support/factories/element/ui_input.rb +13 -0
- data/spec/support/factories/issue.rb +0 -13
- data/spec/support/fixtures/report.afr +0 -0
- data/spec/support/fixtures/{taint_check/taint.rb → signature_check/signature.rb} +2 -2
- data/spec/support/helpers/browser_cluster/jobs/taint_tracer.rb +11 -11
- data/spec/support/helpers/framework.rb +1 -1
- data/spec/support/helpers/pages.rb +2 -2
- data/spec/support/servers/arachni/browser.rb +139 -0
- data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +40 -0
- data/spec/support/servers/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +0 -0
- data/spec/support/servers/arachni/element/input/input_dom.rb +102 -0
- data/spec/support/servers/arachni/element/ui_form/ui_form_dom.rb +238 -0
- data/spec/support/servers/checks/active/trainer_check.rb +7 -7
- data/spec/support/servers/checks/active/unvalidated_redirect_dom.rb +22 -6
- data/spec/support/servers/checks/active/xss_dom.rb +50 -0
- data/spec/support/servers/checks/active/xss_dom_script_context.rb +53 -0
- data/spec/support/shared/browser/javascript/taint_tracer/sink/base.rb +6 -6
- data/spec/support/shared/check.rb +10 -12
- data/spec/support/shared/component/options/base.rb +24 -24
- data/spec/support/shared/element/base.rb +25 -25
- data/spec/support/shared/element/capabilities/auditable.rb +116 -140
- data/spec/support/shared/element/capabilities/dom_only.rb +65 -0
- data/spec/support/shared/element/capabilities/inputtable.rb +71 -86
- data/spec/support/shared/element/capabilities/mutable.rb +122 -111
- data/spec/support/shared/element/capabilities/refreshable.rb +10 -10
- data/spec/support/shared/element/capabilities/{submitable.rb → submittable.rb} +26 -26
- data/spec/support/shared/element/capabilities/with_auditor.rb +10 -10
- data/spec/support/shared/element/capabilities/with_dom.rb +8 -8
- data/spec/support/shared/element/capabilities/with_node.rb +4 -6
- data/spec/support/shared/element/capabilities/with_scope.rb +2 -2
- data/spec/support/shared/element/capabilities/with_source.rb +6 -8
- data/spec/support/shared/element/dom.rb +144 -0
- data/spec/support/shared/element/dom/auditable.rb +42 -0
- data/spec/support/shared/element/dom/inputtable.rb +5 -0
- data/spec/support/shared/element/dom/mutable.rb +3 -0
- data/spec/support/shared/element/dom/submittable.rb +119 -0
- data/spec/support/shared/external/wavsep.rb +3 -3
- data/spec/support/shared/fingerprinter.rb +2 -2
- data/spec/support/shared/framework.rb +1 -1
- data/spec/support/shared/http/message.rb +9 -9
- data/spec/support/shared/option_group.rb +17 -17
- data/spec/support/shared/path_extractor.rb +1 -1
- data/spec/support/shared/plugin.rb +2 -2
- data/spec/support/shared/support/cache.rb +57 -57
- data/spec/support/shared/support/lookup.rb +25 -25
- data/ui/cli/framework.rb +22 -11
- data/ui/cli/framework/option_parser.rb +15 -0
- data/ui/cli/option_parser.rb +8 -1
- data/ui/cli/output.rb +2 -1
- metadata +54 -20
- data/components/checks/active/xss_dom_inputs.rb +0 -236
- data/spec/components/checks/active/xss_dom_inputs_spec.rb +0 -30
- data/spec/support/servers/checks/active/xss_dom_inputs.rb +0 -59
- data/spec/support/shared/element/capabilities/auditable/dom.rb +0 -322
@@ -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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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 ).
|
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?( [] ).
|
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 ).
|
27
|
-
[ :tag ].includes_tags?( :tag ).
|
28
|
-
[ :tag ].includes_tags?( 'tag' ).
|
29
|
-
%w(tag).includes_tags?( 'tag' ).
|
30
|
-
%w(tag).includes_tags?( :tag ).
|
31
|
-
[ :tag, 'tag' ].includes_tags?( :tag ).
|
32
|
-
[ :tag, 'tag' ].includes_tags?( 'tag' ).
|
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 ).
|
38
|
-
[ :tag ].includes_tags?( :tag1 ).
|
39
|
-
[ :tag ].includes_tags?( 'tag2' ).
|
40
|
-
%w(tag).includes_tags?( 'tag3' ).
|
41
|
-
%w(tag).includes_tags?( :tag5 ).
|
42
|
-
[ :tag, 'tag' ].includes_tags?( :ta5g ).
|
43
|
-
[ :tag, 'tag' ].includes_tags?( 'ta4g' ).
|
44
|
-
[ :t3ag, 'tag1' ].includes_tags?( 'tag' ).
|
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] ).
|
53
|
-
[ :tag ].includes_tags?( [:tag] ).
|
54
|
-
[ :tag ].includes_tags?( ['tag', 12] ).
|
55
|
-
%w(tag).includes_tags?( ['tag', nil] ).
|
56
|
-
%w(tag).includes_tags?( [:tag] ).
|
57
|
-
[ :tag, 'tag' ].includes_tags?( [:tag] ).
|
58
|
-
[ :tag, 'tag' ].includes_tags?( ['tag', :blah] ).
|
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] ).
|
64
|
-
[ :tag ].includes_tags?( [:ta3g] ).
|
65
|
-
[ :tag ].includes_tags?( ['ta3g', 12] ).
|
66
|
-
%w(tag).includes_tags?( ['ta3g', nil] ).
|
67
|
-
%w(tag).includes_tags?( [:t4ag] ).
|
68
|
-
[ :tag, 'tag' ].includes_tags?( [:t3ag] ).
|
69
|
-
[ :tag, 'tag' ].includes_tags?( ['t2ag', :b3lah] ).
|
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.
|
83
|
-
recoded.last.
|
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.
|
91
|
-
chunks.each { |c| c.size.
|
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.
|
94
|
+
expect(chunks.size).to eq(3)
|
95
95
|
|
96
|
-
chunks[0].size.
|
97
|
-
chunks[1].size.
|
98
|
-
chunks[2].size.
|
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.
|
104
|
+
expect(chunks.size).to eq(2)
|
105
105
|
|
106
106
|
24.times do |i|
|
107
|
-
chunks.first[i].
|
108
|
-
chunks.last[i].
|
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.
|
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 ).
|
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.
|
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 ).
|
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.
|
69
|
-
converted.keys.map(&:frozen?).uniq.
|
70
|
-
converted.values.map(&:frozen?).uniq.
|
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.
|
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.
|
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].
|
103
|
-
recoded[:blah2][:blah3].
|
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.
|
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.
|
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
|
@@ -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.
|
10
|
-
set.shift.
|
11
|
-
set.size.
|
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 ).
|
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 ).
|
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
|
-
).
|
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.
|
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 ).
|
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( '' ).
|
111
|
-
'test'.diff_ratio( 'test' ).
|
112
|
-
'test this'.diff_ratio( 'test this' ).
|
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' ).
|
118
|
-
'test'.diff_ratio( 'toast' ).
|
119
|
-
'test this'.diff_ratio( 'toast that' ).
|
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' ).
|
125
|
-
'test this here now'.diff_ratio( 'test that here now' ).
|
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' ).
|
131
|
-
'test this here now'.diff_ratio( 'test that here later' ).
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
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
|
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.
|
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.
|
211
|
+
expect('o tw longest'.shortest_word).to eq('o')
|
212
212
|
end
|
213
213
|
end
|
214
214
|
end
|