metasploit-model 0.24.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +27 -0
- data/.rspec +4 -0
- data/.simplecov +38 -0
- data/.travis.yml +6 -0
- data/.yardopts +5 -0
- data/Gemfile +43 -0
- data/LICENSE +27 -0
- data/README.md +33 -0
- data/Rakefile +52 -0
- data/app/models/metasploit/model/association/reflection.rb +46 -0
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +125 -0
- data/app/models/metasploit/model/module/class/spec/template.rb +92 -0
- data/app/models/metasploit/model/module/instance/spec/template.rb +97 -0
- data/app/models/metasploit/model/search/group/base.rb +21 -0
- data/app/models/metasploit/model/search/group/intersection.rb +4 -0
- data/app/models/metasploit/model/search/group/union.rb +4 -0
- data/app/models/metasploit/model/search/operation/base.rb +39 -0
- data/app/models/metasploit/model/search/operation/boolean.rb +36 -0
- data/app/models/metasploit/model/search/operation/date.rb +37 -0
- data/app/models/metasploit/model/search/operation/integer.rb +14 -0
- data/app/models/metasploit/model/search/operation/null.rb +26 -0
- data/app/models/metasploit/model/search/operation/set.rb +34 -0
- data/app/models/metasploit/model/search/operation/set/integer.rb +5 -0
- data/app/models/metasploit/model/search/operation/set/string.rb +5 -0
- data/app/models/metasploit/model/search/operation/string.rb +11 -0
- data/app/models/metasploit/model/search/operation/union.rb +59 -0
- data/app/models/metasploit/model/search/operator/association.rb +43 -0
- data/app/models/metasploit/model/search/operator/attribute.rb +60 -0
- data/app/models/metasploit/model/search/operator/base.rb +34 -0
- data/app/models/metasploit/model/search/operator/delegation.rb +40 -0
- data/app/models/metasploit/model/search/operator/deprecated/app.rb +27 -0
- data/app/models/metasploit/model/search/operator/deprecated/author.rb +33 -0
- data/app/models/metasploit/model/search/operator/deprecated/authority.rb +43 -0
- data/app/models/metasploit/model/search/operator/deprecated/platform.rb +45 -0
- data/app/models/metasploit/model/search/operator/deprecated/ref.rb +50 -0
- data/app/models/metasploit/model/search/operator/deprecated/text.rb +32 -0
- data/app/models/metasploit/model/search/operator/null.rb +44 -0
- data/app/models/metasploit/model/search/operator/single.rb +98 -0
- data/app/models/metasploit/model/search/operator/union.rb +33 -0
- data/app/models/metasploit/model/search/query.rb +171 -0
- data/app/models/metasploit/model/spec/template.rb +273 -0
- data/app/models/metasploit/model/visitation/visitor.rb +69 -0
- data/app/validators/derivation_validator.rb +17 -0
- data/app/validators/dynamic_length_validator.rb +45 -0
- data/app/validators/ip_format_validator.rb +31 -0
- data/app/validators/nil_validator.rb +16 -0
- data/app/validators/parameters_validator.rb +147 -0
- data/app/validators/password_is_strong_validator.rb +115 -0
- data/config/locales/en.yml +209 -0
- data/lib/metasploit/model.rb +38 -0
- data/lib/metasploit/model/architecture.rb +346 -0
- data/lib/metasploit/model/association.rb +49 -0
- data/lib/metasploit/model/association/error.rb +40 -0
- data/lib/metasploit/model/author.rb +58 -0
- data/lib/metasploit/model/authority.rb +134 -0
- data/lib/metasploit/model/authority/bid.rb +10 -0
- data/lib/metasploit/model/authority/cve.rb +10 -0
- data/lib/metasploit/model/authority/msb.rb +10 -0
- data/lib/metasploit/model/authority/osvdb.rb +10 -0
- data/lib/metasploit/model/authority/pmasa.rb +10 -0
- data/lib/metasploit/model/authority/secunia.rb +10 -0
- data/lib/metasploit/model/authority/us_cert_vu.rb +10 -0
- data/lib/metasploit/model/authority/waraxe.rb +31 -0
- data/lib/metasploit/model/authority/zdi.rb +10 -0
- data/lib/metasploit/model/base.rb +25 -0
- data/lib/metasploit/model/configuration.rb +72 -0
- data/lib/metasploit/model/configuration/autoload.rb +109 -0
- data/lib/metasploit/model/configuration/child.rb +12 -0
- data/lib/metasploit/model/configuration/error.rb +4 -0
- data/lib/metasploit/model/configuration/i18n.rb +54 -0
- data/lib/metasploit/model/configuration/parent.rb +50 -0
- data/lib/metasploit/model/configured.rb +46 -0
- data/lib/metasploit/model/derivation.rb +110 -0
- data/lib/metasploit/model/derivation/full_name.rb +25 -0
- data/lib/metasploit/model/email_address.rb +128 -0
- data/lib/metasploit/model/engine.rb +34 -0
- data/lib/metasploit/model/error.rb +7 -0
- data/lib/metasploit/model/file.rb +49 -0
- data/lib/metasploit/model/invalid.rb +17 -0
- data/lib/metasploit/model/module.rb +8 -0
- data/lib/metasploit/model/module/action.rb +58 -0
- data/lib/metasploit/model/module/ancestor.rb +494 -0
- data/lib/metasploit/model/module/architecture.rb +40 -0
- data/lib/metasploit/model/module/author.rb +47 -0
- data/lib/metasploit/model/module/class.rb +406 -0
- data/lib/metasploit/model/module/handler.rb +35 -0
- data/lib/metasploit/model/module/instance.rb +626 -0
- data/lib/metasploit/model/module/path.rb +165 -0
- data/lib/metasploit/model/module/platform.rb +38 -0
- data/lib/metasploit/model/module/rank.rb +91 -0
- data/lib/metasploit/model/module/reference.rb +38 -0
- data/lib/metasploit/model/module/stance.rb +22 -0
- data/lib/metasploit/model/module/target.rb +80 -0
- data/lib/metasploit/model/module/target/architecture.rb +42 -0
- data/lib/metasploit/model/module/target/platform.rb +42 -0
- data/lib/metasploit/model/module/type.rb +44 -0
- data/lib/metasploit/model/nilify_blanks.rb +53 -0
- data/lib/metasploit/model/platform.rb +250 -0
- data/lib/metasploit/model/real_pathname.rb +18 -0
- data/lib/metasploit/model/reference.rb +108 -0
- data/lib/metasploit/model/search.rb +63 -0
- data/lib/metasploit/model/search/association.rb +32 -0
- data/lib/metasploit/model/search/attribute.rb +51 -0
- data/lib/metasploit/model/search/operation.rb +31 -0
- data/lib/metasploit/model/search/operation/integer/value.rb +33 -0
- data/lib/metasploit/model/search/operation/string/value.rb +14 -0
- data/lib/metasploit/model/search/operator.rb +10 -0
- data/lib/metasploit/model/search/operator/help.rb +47 -0
- data/lib/metasploit/model/search/with.rb +40 -0
- data/lib/metasploit/model/spec.rb +140 -0
- data/lib/metasploit/model/spec/error.rb +9 -0
- data/lib/metasploit/model/spec/i18n_exception_handler.rb +19 -0
- data/lib/metasploit/model/spec/pathname_collision.rb +28 -0
- data/lib/metasploit/model/spec/template/write.rb +42 -0
- data/lib/metasploit/model/spec/temporary_pathname.rb +59 -0
- data/lib/metasploit/model/translation.rb +31 -0
- data/lib/metasploit/model/version.rb +31 -0
- data/lib/metasploit/model/visitation.rb +9 -0
- data/lib/metasploit/model/visitation/visit.rb +103 -0
- data/lib/tasks/yard.rake +30 -0
- data/metasploit-model.gemspec +39 -0
- data/script/rails +9 -0
- data/spec/app/models/metasploit/model/association/reflection_spec.rb +48 -0
- data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +174 -0
- data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +222 -0
- data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +201 -0
- data/spec/app/models/metasploit/model/search/group/base_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/group/union_spec.rb +5 -0
- data/spec/app/models/metasploit/model/search/operation/base_spec.rb +70 -0
- data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +56 -0
- data/spec/app/models/metasploit/model/search/operation/date_spec.rb +89 -0
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +9 -0
- data/spec/app/models/metasploit/model/search/operation/null_spec.rb +64 -0
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +7 -0
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +7 -0
- data/spec/app/models/metasploit/model/search/operation/set_spec.rb +126 -0
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +9 -0
- data/spec/app/models/metasploit/model/search/operation/union_spec.rb +124 -0
- data/spec/app/models/metasploit/model/search/operator/association_spec.rb +108 -0
- data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +104 -0
- data/spec/app/models/metasploit/model/search/operator/base_spec.rb +34 -0
- data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +108 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +62 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +161 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +123 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +112 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +327 -0
- data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +357 -0
- data/spec/app/models/metasploit/model/search/operator/null_spec.rb +41 -0
- data/spec/app/models/metasploit/model/search/operator/single_spec.rb +327 -0
- data/spec/app/models/metasploit/model/search/operator/union_spec.rb +92 -0
- data/spec/app/models/metasploit/model/search/query_spec.rb +742 -0
- data/spec/app/models/metasploit/model/spec/template_spec.rb +23 -0
- data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +45 -0
- data/spec/app/validators/derivation_validator_spec.rb +92 -0
- data/spec/app/validators/dynamic_length_validator_spec.rb +293 -0
- data/spec/app/validators/ip_format_validator_spec.rb +124 -0
- data/spec/app/validators/nil_validator_spec.rb +69 -0
- data/spec/app/validators/parameters_validator_spec.rb +342 -0
- data/spec/app/validators/password_is_strong_validator_spec.rb +250 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/dummy/architecture.rb +92 -0
- data/spec/dummy/app/models/dummy/author.rb +15 -0
- data/spec/dummy/app/models/dummy/authority.rb +130 -0
- data/spec/dummy/app/models/dummy/email_address.rb +27 -0
- data/spec/dummy/app/models/dummy/module/action.rb +25 -0
- data/spec/dummy/app/models/dummy/module/ancestor.rb +67 -0
- data/spec/dummy/app/models/dummy/module/architecture.rb +19 -0
- data/spec/dummy/app/models/dummy/module/author.rb +28 -0
- data/spec/dummy/app/models/dummy/module/class.rb +69 -0
- data/spec/dummy/app/models/dummy/module/instance.rb +209 -0
- data/spec/dummy/app/models/dummy/module/path.rb +64 -0
- data/spec/dummy/app/models/dummy/module/platform.rb +19 -0
- data/spec/dummy/app/models/dummy/module/rank.rb +44 -0
- data/spec/dummy/app/models/dummy/module/reference.rb +19 -0
- data/spec/dummy/app/models/dummy/module/target.rb +62 -0
- data/spec/dummy/app/models/dummy/module/target/architecture.rb +19 -0
- data/spec/dummy/app/models/dummy/module/target/platform.rb +19 -0
- data/spec/dummy/app/models/dummy/platform.rb +58 -0
- data/spec/dummy/app/models/dummy/reference.rb +31 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +63 -0
- data/spec/dummy/config/environments/test.rb +29 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/spec/dummy/config/locales/en.yml +1 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/db/schema.rb +707 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/spec/factories/dummy/architectures.rb +13 -0
- data/spec/dummy/spec/factories/dummy/authorities.rb +32 -0
- data/spec/dummy/spec/factories/dummy/authors.rb +8 -0
- data/spec/dummy/spec/factories/dummy/email_addresses.rb +8 -0
- data/spec/dummy/spec/factories/dummy/module/actions.rb +13 -0
- data/spec/dummy/spec/factories/dummy/module/ancestors.rb +45 -0
- data/spec/dummy/spec/factories/dummy/module/architectures.rb +35 -0
- data/spec/dummy/spec/factories/dummy/module/authors.rb +10 -0
- data/spec/dummy/spec/factories/dummy/module/classes.rb +40 -0
- data/spec/dummy/spec/factories/dummy/module/instances.rb +86 -0
- data/spec/dummy/spec/factories/dummy/module/paths.rb +16 -0
- data/spec/dummy/spec/factories/dummy/module/platforms.rb +35 -0
- data/spec/dummy/spec/factories/dummy/module/ranks.rb +14 -0
- data/spec/dummy/spec/factories/dummy/module/references.rb +17 -0
- data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +40 -0
- data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +41 -0
- data/spec/dummy/spec/factories/dummy/module/targets.rb +46 -0
- data/spec/dummy/spec/factories/dummy/platforms.rb +3 -0
- data/spec/dummy/spec/factories/dummy/references.rb +26 -0
- data/spec/factories/metasploit/model/architectures.rb +6 -0
- data/spec/factories/metasploit/model/association/reflections.rb +9 -0
- data/spec/factories/metasploit/model/authorities.rb +28 -0
- data/spec/factories/metasploit/model/authors.rb +9 -0
- data/spec/factories/metasploit/model/bases.rb +10 -0
- data/spec/factories/metasploit/model/email_addresses.rb +14 -0
- data/spec/factories/metasploit/model/module/actions.rb +9 -0
- data/spec/factories/metasploit/model/module/ancestors.rb +180 -0
- data/spec/factories/metasploit/model/module/architectures.rb +15 -0
- data/spec/factories/metasploit/model/module/classes.rb +47 -0
- data/spec/factories/metasploit/model/module/handlers.rb +3 -0
- data/spec/factories/metasploit/model/module/instances.rb +83 -0
- data/spec/factories/metasploit/model/module/paths.rb +51 -0
- data/spec/factories/metasploit/model/module/platforms.rb +15 -0
- data/spec/factories/metasploit/model/module/ranks.rb +9 -0
- data/spec/factories/metasploit/model/module/references.rb +11 -0
- data/spec/factories/metasploit/model/module/stances.rb +3 -0
- data/spec/factories/metasploit/model/module/targets.rb +22 -0
- data/spec/factories/metasploit/model/module/types.rb +5 -0
- data/spec/factories/metasploit/model/references.rb +88 -0
- data/spec/factories/metasploit/model/search/operator/associations.rb +5 -0
- data/spec/factories/metasploit/model/search/operator/attributes.rb +7 -0
- data/spec/factories/metasploit/model/search/operator/bases.rb +5 -0
- data/spec/lib/metasploit/model/architecture_spec.rb +52 -0
- data/spec/lib/metasploit/model/association/error_spec.rb +48 -0
- data/spec/lib/metasploit/model/association_spec.rb +145 -0
- data/spec/lib/metasploit/model/author_spec.rb +6 -0
- data/spec/lib/metasploit/model/authority/bid_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/cve_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/msb_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/osvdb_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/pmasa_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/secunia_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +17 -0
- data/spec/lib/metasploit/model/authority/waraxe_spec.rb +51 -0
- data/spec/lib/metasploit/model/authority/zdi_spec.rb +21 -0
- data/spec/lib/metasploit/model/authority_spec.rb +10 -0
- data/spec/lib/metasploit/model/base_spec.rb +58 -0
- data/spec/lib/metasploit/model/configuration/autoload_spec.rb +165 -0
- data/spec/lib/metasploit/model/configuration/child_spec.rb +24 -0
- data/spec/lib/metasploit/model/configuration/error_spec.rb +5 -0
- data/spec/lib/metasploit/model/configuration/i18n_spec.rb +103 -0
- data/spec/lib/metasploit/model/configuration_spec.rb +106 -0
- data/spec/lib/metasploit/model/configured_spec.rb +41 -0
- data/spec/lib/metasploit/model/derivation/full_name_spec.rb +75 -0
- data/spec/lib/metasploit/model/derivation_spec.rb +217 -0
- data/spec/lib/metasploit/model/email_address_spec.rb +19 -0
- data/spec/lib/metasploit/model/engine_spec.rb +84 -0
- data/spec/lib/metasploit/model/file_spec.rb +43 -0
- data/spec/lib/metasploit/model/invalid_spec.rb +54 -0
- data/spec/lib/metasploit/model/module/action_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/ancestor_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/architecture_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/author_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/class_spec.rb +19 -0
- data/spec/lib/metasploit/model/module/handler_spec.rb +61 -0
- data/spec/lib/metasploit/model/module/instance_spec.rb +183 -0
- data/spec/lib/metasploit/model/module/path_spec.rb +6 -0
- data/spec/lib/metasploit/model/module/platform_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/rank_spec.rb +29 -0
- data/spec/lib/metasploit/model/module/reference_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/stance_spec.rb +30 -0
- data/spec/lib/metasploit/model/module/target/architecture_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/target/platform_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/target_spec.rb +9 -0
- data/spec/lib/metasploit/model/module/type_spec.rb +125 -0
- data/spec/lib/metasploit/model/nilify_blanks_spec.rb +156 -0
- data/spec/lib/metasploit/model/platform_spec.rb +100 -0
- data/spec/lib/metasploit/model/reference_spec.rb +21 -0
- data/spec/lib/metasploit/model/search/association_spec.rb +33 -0
- data/spec/lib/metasploit/model/search/attribute_spec.rb +99 -0
- data/spec/lib/metasploit/model/search/operation/integer/value_spec.rb +20 -0
- data/spec/lib/metasploit/model/search/operation/string/value_spec.rb +20 -0
- data/spec/lib/metasploit/model/search/operation_spec.rb +144 -0
- data/spec/lib/metasploit/model/search/operator/help_spec.rb +41 -0
- data/spec/lib/metasploit/model/search/with_spec.rb +81 -0
- data/spec/lib/metasploit/model/search_spec.rb +230 -0
- data/spec/lib/metasploit/model/spec/error_spec.rb +5 -0
- data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +42 -0
- data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +55 -0
- data/spec/lib/metasploit/model/spec_spec.rb +114 -0
- data/spec/lib/metasploit/model/translation_spec.rb +82 -0
- data/spec/lib/metasploit/model/version_spec.rb +141 -0
- data/spec/lib/metasploit/model/visitation/visit_spec.rb +316 -0
- data/spec/lib/metasploit/model_spec.rb +68 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/support/shared/contexts/metasploit/model/configuration.rb +11 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +12 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +10 -0
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +15 -0
- data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +13 -0
- data/spec/support/shared/examples/derives.rb +115 -0
- data/spec/support/shared/examples/metasploit/model/architecture.rb +425 -0
- data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +25 -0
- data/spec/support/shared/examples/metasploit/model/author.rb +27 -0
- data/spec/support/shared/examples/metasploit/model/authority.rb +124 -0
- data/spec/support/shared/examples/metasploit/model/authority/seed.rb +49 -0
- data/spec/support/shared/examples/metasploit/model/configuration/parent/child.rb +60 -0
- data/spec/support/shared/examples/metasploit/model/email_address.rb +220 -0
- data/spec/support/shared/examples/metasploit/model/module/action.rb +26 -0
- data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +2004 -0
- data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +63 -0
- data/spec/support/shared/examples/metasploit/model/module/architecture.rb +36 -0
- data/spec/support/shared/examples/metasploit/model/module/author.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/module/class.rb +1514 -0
- data/spec/support/shared/examples/metasploit/model/module/handler.rb +21 -0
- data/spec/support/shared/examples/metasploit/model/module/instance.rb +1384 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +537 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +22 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +38 -0
- data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +131 -0
- data/spec/support/shared/examples/metasploit/model/module/path.rb +493 -0
- data/spec/support/shared/examples/metasploit/model/module/platform.rb +36 -0
- data/spec/support/shared/examples/metasploit/model/module/rank.rb +92 -0
- data/spec/support/shared/examples/metasploit/model/module/reference.rb +16 -0
- data/spec/support/shared/examples/metasploit/model/module/target.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +56 -0
- data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +56 -0
- data/spec/support/shared/examples/metasploit/model/platform.rb +213 -0
- data/spec/support/shared/examples/metasploit/model/real_pathname.rb +29 -0
- data/spec/support/shared/examples/metasploit/model/reference.rb +410 -0
- data/spec/support/shared/examples/metasploit/model/search/operation/integer/value.rb +79 -0
- data/spec/support/shared/examples/metasploit/model/search/operation/string/value.rb +53 -0
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +134 -0
- data/spec/support/shared/examples/metasploit/model/translation.rb +37 -0
- data/spec/support/shared/examples/search/query.rb +43 -0
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +44 -0
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +60 -0
- data/spec/support/shared/examples/search_association.rb +13 -0
- data/spec/support/shared/examples/search_attribute.rb +27 -0
- data/spec/support/shared/examples/search_with.rb +36 -0
- data/spec/support/shared/matchers/allow_attribute.rb +17 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +9 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +8 -0
- data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +6 -0
- data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +3 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +5 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +4 -0
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +20 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +1 -0
- data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +9 -0
- metadata +747 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Module::Instance is not stanced with module_type' do |context_module_type|
|
2
|
+
context "with #{context_module_type.inspect}" do
|
3
|
+
# define as a let so that lets from outer context can access option to set detail.
|
4
|
+
let(:module_type) do
|
5
|
+
context_module_type
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have #{context_module_type.inspect} for module_class.module_type" do
|
9
|
+
module_instance.module_class.module_type.should == module_type
|
10
|
+
end
|
11
|
+
|
12
|
+
it { should_not be_stanced }
|
13
|
+
|
14
|
+
context 'with nil stance' do
|
15
|
+
let(:stance) do
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it { should be_valid }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Module::Instance is stanced with module_type' do |context_module_type|
|
2
|
+
context "with #{context_module_type.inspect}" do
|
3
|
+
# define as a let so that lets from outer context can access option to set detail.
|
4
|
+
let(:module_type) do
|
5
|
+
context_module_type
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have #{context_module_type.inspect} for module_class.module_type" do
|
9
|
+
module_instance.module_class.module_type.should == module_type
|
10
|
+
end
|
11
|
+
|
12
|
+
it { should be_stanced }
|
13
|
+
|
14
|
+
context 'with nil stance' do
|
15
|
+
let(:stance) do
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it { should be_invalid }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with 'aggresive' stance" do
|
23
|
+
let(:stance) do
|
24
|
+
'aggressive'
|
25
|
+
end
|
26
|
+
|
27
|
+
it { should be_valid }
|
28
|
+
end
|
29
|
+
|
30
|
+
context "with 'passive' stance" do
|
31
|
+
let(:stance) do
|
32
|
+
'passive'
|
33
|
+
end
|
34
|
+
|
35
|
+
it { should be_valid }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
shared_examples_for 'Metasploit::Model::Module::Instance validates dynamic length of' do |attribute, options={}|
|
2
|
+
options.assert_valid_keys(:options_by_extreme_by_module_type, :factory)
|
3
|
+
options_by_extreme_by_module_type = options.fetch(:options_by_extreme_by_module_type)
|
4
|
+
attribute_factory = options.fetch(:factory)
|
5
|
+
|
6
|
+
context attribute do
|
7
|
+
context 'errors' do
|
8
|
+
subject(:attribute_errors) do
|
9
|
+
module_instance.errors[attribute]
|
10
|
+
end
|
11
|
+
|
12
|
+
let(attribute) do
|
13
|
+
FactoryGirl.build_list(
|
14
|
+
attribute_factory,
|
15
|
+
attribute_count,
|
16
|
+
module_instance: module_instance
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:attribute_count) do
|
21
|
+
Random.rand(attribute_count_range)
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:error) do
|
25
|
+
# need to use human_attribute_name to emulate error translation process from ActiveModel::Errors.
|
26
|
+
I18n.translate!(
|
27
|
+
error_key,
|
28
|
+
count: extreme_value,
|
29
|
+
attribute: human_attribute_name
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:error_key) do
|
34
|
+
"metasploit.model.errors.models.metasploit/model/module/instance.attributes.#{attribute}.#{error_type}"
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:human_attribute_name) do
|
38
|
+
module_instance.class.human_attribute_name(attribute)
|
39
|
+
end
|
40
|
+
|
41
|
+
before(:each) do
|
42
|
+
module_instance.send("#{attribute}=", send(attribute))
|
43
|
+
module_instance.module_class.module_type = module_type
|
44
|
+
# populate attribute_errors
|
45
|
+
module_instance.valid?
|
46
|
+
end
|
47
|
+
|
48
|
+
context '#module_type' do
|
49
|
+
Metasploit::Model::Module::Type::ALL.each do |module_type|
|
50
|
+
options_by_extreme = options_by_extreme_by_module_type.fetch(module_type)
|
51
|
+
|
52
|
+
options_by_extreme.assert_valid_keys(:maximum, :minimum)
|
53
|
+
|
54
|
+
maximum_options = options_by_extreme.fetch(:maximum)
|
55
|
+
maximum_options.assert_valid_keys(:extreme, :error_type)
|
56
|
+
maximum = maximum_options.fetch(:extreme)
|
57
|
+
|
58
|
+
minimum_options = options_by_extreme.fetch(:minimum)
|
59
|
+
minimum_options.assert_valid_keys(:extreme, :error_type)
|
60
|
+
minimum = minimum_options.fetch(:extreme)
|
61
|
+
|
62
|
+
context "with #{module_type.inspect}" do
|
63
|
+
# has to be captured in a let so before(:each) in outer context can use it
|
64
|
+
let(:module_type) do
|
65
|
+
module_type
|
66
|
+
end
|
67
|
+
|
68
|
+
if minimum > 0
|
69
|
+
# fetch error_type here because it is only needs to be given if minimum > 0.
|
70
|
+
minimum_error_type = minimum_options.fetch(:error_type)
|
71
|
+
|
72
|
+
context "below minimum (#{minimum})" do
|
73
|
+
let(:attribute_count_range) do
|
74
|
+
0 ... minimum
|
75
|
+
end
|
76
|
+
|
77
|
+
let(:error_type) do
|
78
|
+
minimum_error_type
|
79
|
+
end
|
80
|
+
|
81
|
+
let(:extreme_value) do
|
82
|
+
minimum
|
83
|
+
end
|
84
|
+
|
85
|
+
it { should include(error) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
clamped_minimum = 2 * minimum + 1
|
90
|
+
# maximum may be infinity, so need to clamp it to a more realistic value that can be built from factories
|
91
|
+
clamped_maximum = [maximum, clamped_minimum].min
|
92
|
+
|
93
|
+
if maximum > minimum
|
94
|
+
context "in range (#{minimum} .. #{maximum})" do
|
95
|
+
let(:attribute_count_range) do
|
96
|
+
minimum .. clamped_maximum
|
97
|
+
end
|
98
|
+
|
99
|
+
it { should be_empty }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
if maximum < Float::INFINITY
|
104
|
+
# fetch error_type here because it only needs to be given if maximum is not ∞
|
105
|
+
maximum_error_type = maximum_options.fetch(:error_type)
|
106
|
+
|
107
|
+
context "above maximum (#{maximum})" do
|
108
|
+
above_maximum = maximum + 1
|
109
|
+
|
110
|
+
let(:attribute_count_range) do
|
111
|
+
# 2 to double the range
|
112
|
+
above_maximum .. (2 * above_maximum)
|
113
|
+
end
|
114
|
+
|
115
|
+
let(:error_type) do
|
116
|
+
maximum_error_type
|
117
|
+
end
|
118
|
+
|
119
|
+
let(:extreme_value) do
|
120
|
+
maximum
|
121
|
+
end
|
122
|
+
|
123
|
+
it { should include(error) }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,493 @@
|
|
1
|
+
Metasploit::Model::Spec.shared_examples_for 'Module::Path' do
|
2
|
+
named_module_path_factory = "named_#{module_path_factory}"
|
3
|
+
unnamed_module_path_factory = "un#{named_module_path_factory}"
|
4
|
+
|
5
|
+
it { should be_a ActiveModel::Dirty }
|
6
|
+
|
7
|
+
it_should_behave_like 'Metasploit::Model::RealPathname' do
|
8
|
+
let(:base_instance) do
|
9
|
+
FactoryGirl.build(module_path_factory)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'callbacks' do
|
14
|
+
context 'before_validation' do
|
15
|
+
context 'nilify blanks' do
|
16
|
+
let(:path) do
|
17
|
+
FactoryGirl.build(
|
18
|
+
module_path_factory,
|
19
|
+
:gem => '',
|
20
|
+
:name => ''
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have empty gem' do
|
25
|
+
path.gem.should_not be_nil
|
26
|
+
path.gem.should be_empty
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should have empty name' do
|
30
|
+
path.name.should_not be_nil
|
31
|
+
path.name.should be_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'after validation' do
|
35
|
+
before(:each) do
|
36
|
+
path.valid?
|
37
|
+
end
|
38
|
+
|
39
|
+
its(:gem) { should be_nil }
|
40
|
+
its(:name) { should be_nil }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#normalize_real_path' do
|
45
|
+
let(:parent_pathname) do
|
46
|
+
Metasploit::Model::Spec.temporary_pathname.join('metasploit', 'model', 'module', 'path')
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:path) do
|
50
|
+
FactoryGirl.build(
|
51
|
+
module_path_factory,
|
52
|
+
:real_path => symlink_pathname.to_path
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
let(:real_basename) do
|
57
|
+
'real'
|
58
|
+
end
|
59
|
+
|
60
|
+
let(:real_pathname) do
|
61
|
+
parent_pathname.join(real_basename)
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:symlink_basename) do
|
65
|
+
'symlink'
|
66
|
+
end
|
67
|
+
|
68
|
+
let(:symlink_pathname) do
|
69
|
+
parent_pathname.join(symlink_basename)
|
70
|
+
end
|
71
|
+
|
72
|
+
before(:each) do
|
73
|
+
real_pathname.mkpath
|
74
|
+
|
75
|
+
Dir.chdir(parent_pathname.to_path) do
|
76
|
+
File.symlink(real_basename, 'symlink')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should convert real_path to a real path using File#real_path' do
|
81
|
+
expected_real_path = Metasploit::Model::File.realpath(path.real_path)
|
82
|
+
|
83
|
+
path.real_path.should_not == expected_real_path
|
84
|
+
|
85
|
+
path.valid?
|
86
|
+
|
87
|
+
path.real_path.should == expected_real_path
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'factories' do
|
94
|
+
context module_path_factory do
|
95
|
+
subject(module_path_factory) do
|
96
|
+
FactoryGirl.build(module_path_factory)
|
97
|
+
end
|
98
|
+
|
99
|
+
it { should be_valid }
|
100
|
+
end
|
101
|
+
|
102
|
+
context named_module_path_factory do
|
103
|
+
subject(named_module_path_factory) do
|
104
|
+
FactoryGirl.build(named_module_path_factory)
|
105
|
+
end
|
106
|
+
|
107
|
+
it { should be_valid }
|
108
|
+
|
109
|
+
its(:gem) { should_not be_nil }
|
110
|
+
its(:name) { should_not be_nil }
|
111
|
+
end
|
112
|
+
|
113
|
+
context unnamed_module_path_factory do
|
114
|
+
subject(unnamed_module_path_factory) do
|
115
|
+
FactoryGirl.build(unnamed_module_path_factory)
|
116
|
+
end
|
117
|
+
|
118
|
+
it { should be_valid }
|
119
|
+
|
120
|
+
its(:gem) { should be_nil }
|
121
|
+
its(:name) { should be_nil }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'mass assignment security' do
|
126
|
+
it { should allow_mass_assignment_of(:gem) }
|
127
|
+
it { should allow_mass_assignment_of(:name) }
|
128
|
+
it { should allow_mass_assignment_of(:real_path) }
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'validations' do
|
132
|
+
context 'directory' do
|
133
|
+
let(:error) do
|
134
|
+
'must be a directory'
|
135
|
+
end
|
136
|
+
|
137
|
+
let(:path) do
|
138
|
+
FactoryGirl.build(
|
139
|
+
module_path_factory,
|
140
|
+
:real_path => real_path
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
before(:each) do
|
145
|
+
path.valid?
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'with #real_path' do
|
149
|
+
context 'with directory' do
|
150
|
+
let(:real_path) do
|
151
|
+
FactoryGirl.generate :metasploit_model_module_path_directory_real_path
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should not record error on real_path' do
|
155
|
+
path.valid?
|
156
|
+
|
157
|
+
path.errors[:real_path].should_not include(error)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'with file' do
|
162
|
+
let(:pathname) do
|
163
|
+
Metasploit::Model::Spec.temporary_pathname.join(
|
164
|
+
'metasploit',
|
165
|
+
'model',
|
166
|
+
'module',
|
167
|
+
'path',
|
168
|
+
'real',
|
169
|
+
'path',
|
170
|
+
'file'
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
let(:real_path) do
|
175
|
+
pathname.to_path
|
176
|
+
end
|
177
|
+
|
178
|
+
before(:each) do
|
179
|
+
Metasploit::Model::Spec::PathnameCollision.check!(pathname)
|
180
|
+
|
181
|
+
pathname.parent.mkpath
|
182
|
+
|
183
|
+
pathname.open('wb') do |f|
|
184
|
+
f.puts 'A file'
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should record error on real_path' do
|
189
|
+
path.valid?
|
190
|
+
|
191
|
+
path.errors[:real_path].should include(error)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'without #real_path' do
|
197
|
+
let(:real_path) do
|
198
|
+
nil
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'should record error on real_path' do
|
202
|
+
path.valid?
|
203
|
+
|
204
|
+
path.errors[:real_path].should include(error)
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
context 'gem and name' do
|
210
|
+
let(:gem_error) do
|
211
|
+
"can't be blank if name is present"
|
212
|
+
end
|
213
|
+
|
214
|
+
let(:name_error) do
|
215
|
+
"can't be blank if gem is present"
|
216
|
+
end
|
217
|
+
|
218
|
+
subject(:path) do
|
219
|
+
FactoryGirl.build(
|
220
|
+
module_path_factory,
|
221
|
+
:gem => gem,
|
222
|
+
:name => name
|
223
|
+
)
|
224
|
+
end
|
225
|
+
|
226
|
+
before(:each) do
|
227
|
+
path.valid?
|
228
|
+
end
|
229
|
+
|
230
|
+
context 'with gem' do
|
231
|
+
let(:gem) do
|
232
|
+
FactoryGirl.generate :metasploit_model_module_path_gem
|
233
|
+
end
|
234
|
+
|
235
|
+
context 'with name' do
|
236
|
+
let(:name) do
|
237
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
238
|
+
end
|
239
|
+
|
240
|
+
it 'should not record error on gem' do
|
241
|
+
path.errors[:gem].should_not include(gem_error)
|
242
|
+
end
|
243
|
+
|
244
|
+
it 'should not record error on name' do
|
245
|
+
path.errors[:name].should_not include(name_error)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
context 'without name' do
|
250
|
+
let(:name) do
|
251
|
+
nil
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'should not record error on gem' do
|
255
|
+
path.errors[:gem].should_not include(gem_error)
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'should record error on name' do
|
259
|
+
path.errors[:name].should include(name_error)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
context 'without gem' do
|
265
|
+
let(:gem) do
|
266
|
+
nil
|
267
|
+
end
|
268
|
+
|
269
|
+
context 'with name' do
|
270
|
+
let(:name) do
|
271
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should record error on gem' do
|
275
|
+
path.errors[:gem].should include(gem_error)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'should not record error on name' do
|
279
|
+
path.errors[:name].should_not include(name_error)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
context 'without name' do
|
284
|
+
let(:name) do
|
285
|
+
nil
|
286
|
+
end
|
287
|
+
|
288
|
+
it 'should not record error on gem' do
|
289
|
+
path.errors[:gem].should_not include(gem_error)
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'should not record error on name' do
|
293
|
+
path.errors[:name].should_not include(name_error)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
context '#directory?' do
|
301
|
+
subject(:directory?) do
|
302
|
+
path.directory?
|
303
|
+
end
|
304
|
+
|
305
|
+
let(:path) do
|
306
|
+
FactoryGirl.build(
|
307
|
+
module_path_factory,
|
308
|
+
:real_path => real_path
|
309
|
+
)
|
310
|
+
end
|
311
|
+
|
312
|
+
context 'with #real_path' do
|
313
|
+
context 'with file' do
|
314
|
+
let(:pathname) do
|
315
|
+
Metasploit::Model::Spec.temporary_pathname.join(
|
316
|
+
'metasploit',
|
317
|
+
'model',
|
318
|
+
'module',
|
319
|
+
'path',
|
320
|
+
'real',
|
321
|
+
'path',
|
322
|
+
'file'
|
323
|
+
)
|
324
|
+
end
|
325
|
+
|
326
|
+
let(:real_path) do
|
327
|
+
pathname.to_path
|
328
|
+
end
|
329
|
+
|
330
|
+
before(:each) do
|
331
|
+
Metasploit::Model::Spec::PathnameCollision.check!(pathname)
|
332
|
+
|
333
|
+
pathname.parent.mkpath
|
334
|
+
|
335
|
+
pathname.open('wb') do |f|
|
336
|
+
f.puts 'A file'
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
|
341
|
+
it { should be_false }
|
342
|
+
end
|
343
|
+
|
344
|
+
context 'with directory' do
|
345
|
+
let(:real_path) do
|
346
|
+
FactoryGirl.generate :metasploit_model_module_path_directory_real_path
|
347
|
+
end
|
348
|
+
|
349
|
+
it { should be_true }
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
context 'without #real_path' do
|
354
|
+
let(:real_path) do
|
355
|
+
nil
|
356
|
+
end
|
357
|
+
|
358
|
+
it { should be_false }
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
context '#named?' do
|
363
|
+
subject(:named?) do
|
364
|
+
path.named?
|
365
|
+
end
|
366
|
+
|
367
|
+
let(:path) do
|
368
|
+
FactoryGirl.build(
|
369
|
+
module_path_factory,
|
370
|
+
:gem => gem,
|
371
|
+
:name => name
|
372
|
+
)
|
373
|
+
end
|
374
|
+
|
375
|
+
context 'with blank gem' do
|
376
|
+
let(:gem) do
|
377
|
+
''
|
378
|
+
end
|
379
|
+
|
380
|
+
context 'with blank name' do
|
381
|
+
let(:name) do
|
382
|
+
''
|
383
|
+
end
|
384
|
+
|
385
|
+
it { should be_false }
|
386
|
+
end
|
387
|
+
|
388
|
+
context 'without blank name' do
|
389
|
+
let(:name) do
|
390
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
391
|
+
end
|
392
|
+
|
393
|
+
it { should be_false }
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
context 'without blank gem' do
|
398
|
+
let(:gem) do
|
399
|
+
FactoryGirl.generate :metasploit_model_module_path_gem
|
400
|
+
end
|
401
|
+
|
402
|
+
context 'with blank name' do
|
403
|
+
let(:name) do
|
404
|
+
''
|
405
|
+
end
|
406
|
+
|
407
|
+
it { should be_false }
|
408
|
+
end
|
409
|
+
|
410
|
+
context 'without blank name' do
|
411
|
+
let(:name) do
|
412
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
413
|
+
end
|
414
|
+
|
415
|
+
it { should be_true }
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
context '#was_named?' do
|
421
|
+
subject(:was_named?) do
|
422
|
+
path.was_named?
|
423
|
+
end
|
424
|
+
|
425
|
+
let(:gem) do
|
426
|
+
FactoryGirl.generate :metasploit_model_module_path_gem
|
427
|
+
end
|
428
|
+
|
429
|
+
let(:name) do
|
430
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
431
|
+
end
|
432
|
+
|
433
|
+
let(:path) do
|
434
|
+
FactoryGirl.build(
|
435
|
+
module_path_factory
|
436
|
+
)
|
437
|
+
end
|
438
|
+
|
439
|
+
before(:each) do
|
440
|
+
path.gem = gem_was
|
441
|
+
path.name = name_was
|
442
|
+
|
443
|
+
path.changed_attributes.clear
|
444
|
+
|
445
|
+
path.gem = gem
|
446
|
+
path.name = name
|
447
|
+
end
|
448
|
+
|
449
|
+
context 'with blank gem_was' do
|
450
|
+
let(:gem_was) do
|
451
|
+
nil
|
452
|
+
end
|
453
|
+
|
454
|
+
context 'with blank name_was' do
|
455
|
+
let(:name_was) do
|
456
|
+
nil
|
457
|
+
end
|
458
|
+
|
459
|
+
it { should be_false }
|
460
|
+
end
|
461
|
+
|
462
|
+
context 'without blank name_was' do
|
463
|
+
let(:name_was) do
|
464
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
465
|
+
end
|
466
|
+
|
467
|
+
it { should be_false }
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
context 'without blank gem_was' do
|
472
|
+
let(:gem_was) do
|
473
|
+
FactoryGirl.generate :metasploit_model_module_path_gem
|
474
|
+
end
|
475
|
+
|
476
|
+
context 'with blank name_was' do
|
477
|
+
let(:name_was) do
|
478
|
+
nil
|
479
|
+
end
|
480
|
+
|
481
|
+
it { should be_false }
|
482
|
+
end
|
483
|
+
|
484
|
+
context 'without blank name_was' do
|
485
|
+
let(:name_was) do
|
486
|
+
FactoryGirl.generate :metasploit_model_module_path_name
|
487
|
+
end
|
488
|
+
|
489
|
+
it { should be_true }
|
490
|
+
end
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|