Sha256: 76e28868766c10972e9142a6aa648fd806a61596d72da7d1f77ac34974091413

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

FactoryBot.modify do
  factory :host do
    trait :with_puppetclass do
      transient do
        environment
        puppetclasses { [FactoryBot.create(:puppetclass, environments: [environment])] }
      end
    end

    trait :with_config_group do
      transient do
        environment
        config_groups { [FactoryBot.create(:config_group, :with_puppetclass, class_environments: [environment])] }
      end
    end

    trait :with_puppet_enc do
      transient do
        environment
        puppetclasses { [] }
        config_groups { [] }
      end
      puppet { association :host_puppet_facet, environment: environment, puppetclasses: puppetclasses, config_groups: config_groups }
      puppet_proxy do
        FactoryBot.create(:smart_proxy, features: [FactoryBot.create(:feature, :puppet)])
      end
    end
  end

  factory :hostgroup do
    trait :with_puppetclass do
      transient do
        environment
        puppetclasses { [FactoryBot.create(:puppetclass, environments: [environment])] }
      end
    end

    trait :with_puppet_enc do
      transient do
        environment
        puppetclasses { [] }
        config_groups { [] }
      end
      puppet { association :hostgroup_puppet_facet, :with_config_group, environment: environment, puppetclasses: puppetclasses, config_groups: config_groups }
      puppet_proxy do
        FactoryBot.create(:smart_proxy, features: [FactoryBot.create(:feature, :puppet)])
      end
    end

    trait :with_config_group do
      transient do
        environment
        config_groups { [FactoryBot.create(:config_group, :with_puppetclass, class_environments: [environment])] }
      end
    end
  end

  factory :template_combination do
    environment
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_puppet-0.1.0 test/factories/host_puppet_enhancements.rb
foreman_puppet-0.0.2 test/factories/host_puppet_enhancements.rb
foreman_puppet-0.0.1 test/factories/host_puppet_enhancements.rb