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-15.0.2 test/factories/host_ansible_enhancements.rb
foreman_ansible-15.0.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-15.0.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.2.2 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.2.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.7 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.2.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.1.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.1.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.5 test/factories/host_ansible_enhancements.rb
foreman_ansible-14.0.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.4 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.3 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.2 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.1 test/factories/host_ansible_enhancements.rb
foreman_ansible-13.0.0 test/factories/host_ansible_enhancements.rb
foreman_ansible-12.0.7 test/factories/host_ansible_enhancements.rb
foreman_ansible-10.4.4 test/factories/host_ansible_enhancements.rb
foreman_ansible-7.1.8 test/factories/host_ansible_enhancements.rb
foreman_ansible-12.0.6 test/factories/host_ansible_enhancements.rb