Sha256: 4674ffe18a6d7de61c01bb87db3df06baab93a652244d26ebde7ca94d47f619e

Contents?: true

Size: 861 Bytes

Versions: 53

Compression:

Stored size: 861 Bytes

Contents

FactoryBot.define do
  factory :discovered_host, class: 'Host::Discovered' do
    sequence(:name) { |n| "host#{n}" }
    sequence(:ip)   { |n| IPAddr.new(n, Socket::AF_INET).to_s }
    sequence(:mac)  { |n| "02:23:45:67:" + n.to_s(16).rjust(4, '0').insert(2, ':') }

    after(:build) do |discovered_host|
      attribute_set = DiscoveryAttributeSet.new(:host => discovered_host,
                                                :memory => '1',
                                                :cpu_count => '4')
      discovered_host.discovery_attribute_set = attribute_set
    end

    trait :with_facts do
      transient do
        fact_count { 20 }
      end

      after(:create) do |discovered_host, evaluator|
        evaluator.fact_count.times do
          FactoryBot.create(:fact_value, :host => discovered_host)
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
foreman_discovery-25.1.0 test/factories/discovery_host_related.rb
foreman_discovery-25.0.1 test/factories/discovery_host_related.rb
foreman_discovery-25.0.0 test/factories/discovery_host_related.rb
foreman_discovery-24.0.2 test/factories/discovery_host_related.rb
foreman_discovery-23.0.2 test/factories/discovery_host_related.rb
foreman_discovery-24.0.1 test/factories/discovery_host_related.rb
foreman_discovery-24.0.0 test/factories/discovery_host_related.rb
foreman_discovery-23.0.1 test/factories/discovery_host_related.rb
foreman_discovery-23.0.0 test/factories/discovery_host_related.rb
foreman_discovery-22.0.4 test/factories/discovery_host_related.rb
foreman_discovery-21.0.5 test/factories/discovery_host_related.rb
foreman_discovery-22.0.2 test/factories/discovery_host_related.rb
foreman_discovery-21.0.4 test/factories/discovery_host_related.rb
foreman_discovery-21.0.3 test/factories/discovery_host_related.rb
foreman_discovery-21.0.2 test/factories/discovery_host_related.rb
foreman_discovery-19.0.5 test/factories/discovery_host_related.rb
foreman_discovery-19.0.4 test/factories/discovery_host_related.rb
foreman_discovery-21.0.1 test/factories/discovery_host_related.rb
foreman_discovery-19.0.3 test/factories/discovery_host_related.rb
foreman_discovery-21.0.0 test/factories/discovery_host_related.rb