Sha256: 787da8d14800e357c7e374815c7fd89b3c3d8713e87334b3ee9ff4ab9a9383e7

Contents?: true

Size: 627 Bytes

Versions: 65

Compression:

Stored size: 627 Bytes

Contents

FactoryBot.modify do
  factory :host do
    trait :with_ansible_roles do
      transient do
        roles_count { 2 }
      end
      after(:build) do |host, evaluator|
        host.host_ansible_roles = FactoryBot.build_list(:host_ansible_role, evaluator.roles_count, host: host)
      end
    end
  end

  factory :hostgroup do
    trait :with_ansible_roles do
      transient do
        roles_count { 2 }
      end
      after(:build) do |hostgroup, evaluator|
        hostgroup.hostgroup_ansible_roles = FactoryBot.build_list(:hostgroup_ansible_role, evaluator.roles_count, hostgroup: hostgroup)
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
foreman_ansible-6.3.2 test/factories/host_ansible_enhancements.rb
foreman_ansible-6.3.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-6.4.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-6.4.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-6.3.0 test/factories/host_ansible_enhancements.rb