Sha256: f6216c2e4b42ba929ed133250719042f337ac228104f0c47cb25a1d806c40bd6

Contents?: true

Size: 751 Bytes

Versions: 5

Compression:

Stored size: 751 Bytes

Contents

FactoryGirl.define do
  factory :mdm_service, :class => Mdm::Service do
    #
    # Associations
    #
    association :host, :factory => :mdm_host

    #
    # Attributes
    #
    name { generate :mdm_service_name }
    port { generate :port }
    proto 'snmp'
    state 'open'

    factory :web_service do
      proto 'tcp'
      name { FactoryGirl.generate(:web_service_name) }
    end
  end

  sequence(:mdm_service_name) { |n|
    "mdm_service_name#{n}"
  }

  port_bits = 16
  port_limit = 1 << port_bits

  sequence :port do |n|
    n % port_limit
  end

  web_service_names = ['http', 'https']
  web_service_name_count = web_service_names.length

  sequence :web_service_name do |n|
    web_service_names[n % web_service_name_count]
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metasploit_data_models-0.18.1-java spec/factories/mdm/services.rb
metasploit_data_models-0.18.1 spec/factories/mdm/services.rb
metasploit_data_models-0.18.0 spec/factories/mdm/services.rb
metasploit_data_models-0.18.0-java spec/factories/mdm/services.rb
metasploit_data_models-0.18.0.pre.compatibility spec/factories/mdm/services.rb