Sha256: 02f2001bb3664f47f17347917cfea65ffbb20dea6a217ad47d48c6723b0c380e

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 Bytes

Contents

FactoryGirl.define do
  factory :salt_module, :class => 'ForemanSalt::SaltModule' do
    sequence(:name) { |n| "module#{n}" }
  end

  factory :salt_environment, :class => 'ForemanSalt::SaltEnvironment' do
    sequence(:name) { |n| "environment#{n}" }
  end
end

FactoryGirl.modify do
  factory :host do
    trait :with_salt_proxy do
      salt_proxy { FactoryGirl.build :smart_proxy, :with_salt_feature }
    end
  end

  factory :hostgroup do
    trait :with_salt_proxy do
      salt_proxy { FactoryGirl.build :smart_proxy, :with_salt_feature }
    end

    trait :with_salt_modules do
      salt_environment { FactoryGirl.build :salt_environment }
      salt_modules { FactoryGirl.create_list :salt_module, 10, :salt_environments => [self.salt_environment] }
    end
  end

  factory :smart_proxy do
    trait :with_salt_feature do
      features        { [::Feature.find_or_create_by_name('Salt')] }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_salt-3.0.2 test/factories/foreman_salt_factories.rb
foreman_salt-3.0.1 test/factories/foreman_salt_factories.rb