Sha256: 41e30cfa130c177a83902273239b371415cb713fc3409d5210dbcd6b58debe14

Contents?: true

Size: 1.24 KB

Versions: 47

Compression:

Stored size: 1.24 KB

Contents

FactoryBot.modify do
  factory :feature do
    trait :puppet do
      name { 'Puppet' }
    end
  end

  factory :smart_proxy_feature do
    trait :puppet do
      association :feature, :puppet
    end
  end
end

FactoryBot.factories.instance_variable_get('@items').delete(:puppet_smart_proxy) if FactoryBot.factories.registered?(:puppet_smart_proxy)
FactoryBot.factories.instance_variable_get('@items').delete(:puppet_and_ca_smart_proxy) if FactoryBot.factories.registered?(:puppet_and_ca_smart_proxy)
FactoryBot.define do
  factory :puppet_smart_proxy, parent: :smart_proxy do
    before(:create, :build, :build_stubbed) do
      ProxyAPI::V2::Features.any_instance.stubs(:features).returns(puppet: { 'state' => 'running' })
    end
    after(:build) do |smart_proxy, _evaluator|
      smart_proxy.smart_proxy_features << FactoryBot.build(:smart_proxy_feature, :puppet, smart_proxy: smart_proxy)
    end
  end

  factory :puppet_and_ca_smart_proxy, parent: :smart_proxy do
    after(:build) do |smart_proxy, _evaluator|
      smart_proxy.smart_proxy_features << FactoryBot.build(:smart_proxy_feature, :puppet, smart_proxy: smart_proxy)
      smart_proxy.smart_proxy_features << FactoryBot.build(:smart_proxy_feature, :puppetca, smart_proxy: smart_proxy)
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
foreman_puppet-8.0.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.4.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-7.0.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.3.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.2.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.1.1 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-5.1.3 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.1.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.0.1 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-6.0.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-5.1.2 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-4.1.1 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-5.1.1 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-5.1.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-4.1.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-4.0.4 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-5.0.0 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-4.0.3 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-4.0.2 test/factories/proxy_puppet_enhancements.rb
foreman_puppet-3.0.7 test/factories/proxy_puppet_enhancements.rb