Sha256: 0e0061a12d0d6128b69e95417fcb2de23513e959de678aa3948668817d4231bd

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 Bytes

Contents

FactoryGirl.define do
  factory :smart_proxy, :class => "::SmartProxy" do
    sequence(:name) { |n| "proxy#{n}" }
    sequence(:url)  { |n| "http://proxy#{n}.example.com:9090" }

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

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

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

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

    trait :with_salt_modules do
      salt_modules { FactoryGirl.create_list :salt_module, 10 }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_salt-0.0.4 test/factories/foreman_salt_factories.rb
foreman_salt-0.0.3 test/factories/foreman_salt_factories.rb
foreman_salt-0.0.2 test/factories/foreman_salt_factories.rb