Sha256: a0a0db13f1933a279fe186f7aec8cfea391a67da170c5128cc55a51112a39099

Contents?: true

Size: 1.94 KB

Versions: 38

Compression:

Stored size: 1.94 KB

Contents

FactoryGirl.define do
  factory :mdm_module_detail, :class => Mdm::Module::Detail do
    transient do
      root {
        MetasploitDataModels.root
      }
      modules_pathname { root.join('modules') }
    end

    description { generate :mdm_module_detail_description }
    disclosure_date { generate :mdm_module_detail_disclosure_date }
    license { generate :mdm_module_detail_license }
    mtime { generate :mdm_module_detail_mtime }
    mtype { generate :mdm_module_detail_mtype }
    privileged { generate :mdm_module_detail_privileged }
    name { generate :mdm_module_detail_name }
    rank { generate :mdm_module_detail_rank }
    refname { generate :mdm_module_detail_refname }
    fullname { "#{mtype}/#{refname}" }

    stance {
      if supports_stance?
        generate :mdm_module_detail_stance
      else
        nil
      end
    }

    file {
      type_directory = Mdm::Module::Detail::DIRECTORY_BY_TYPE[mtype]

      modules_pathname.join(
          type_directory,
          "#{refname}.rb"
      ).to_path
    }
  end

  sequence :mdm_module_detail_disclosure_date do |n|
    # @todo https://www.pivotaltracker.com/story/show/48450593
    Date.today - n
  end

  sequence :mdm_module_detail_description do |n|
    "Module Description #{n}"
  end

  sequence :mdm_module_detail_license do |n|
    "Module License v#{n}"
  end

  sequence :mdm_module_detail_privileged, Mdm::Module::Detail::PRIVILEGES.cycle

  sequence :mdm_module_detail_mtime do |n|
    Time.now.utc - n.seconds
  end

  ordered_types = Mdm::Module::Detail::DIRECTORY_BY_TYPE.keys.sort
  sequence :mdm_module_detail_mtype, ordered_types.cycle

  sequence :mdm_module_detail_name do |n|
    "Module Name #{n}"
  end

  ordered_ranks = Mdm::Module::Detail::RANK_BY_NAME.values.sort
  sequence :mdm_module_detail_rank, ordered_ranks.cycle

  sequence :mdm_module_detail_refname do |n|
    "module/ref/name#{n}"
  end

  sequence :mdm_module_detail_stance, Mdm::Module::Detail::STANCES.cycle
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
metasploit_data_models-1.2.8 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.7 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.6 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.5 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.4 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.3 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.2 spec/factories/mdm/module/details.rb
metasploit_data_models-0.24.4 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.1 spec/factories/mdm/module/details.rb
metasploit_data_models-1.2.0 spec/factories/mdm/module/details.rb
metasploit_data_models-1.1.0 spec/factories/mdm/module/details.rb
metasploit_data_models-1.0.1 spec/factories/mdm/module/details.rb
metasploit_data_models-1.0.0 spec/factories/mdm/module/details.rb
metasploit_data_models-0.24.3 spec/factories/mdm/module/details.rb
metasploit_data_models-0.24.2 spec/factories/mdm/module/details.rb
metasploit_data_models-0.24.1 spec/factories/mdm/module/details.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0b spec/factories/mdm/module/details.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0a spec/factories/mdm/module/details.rb