Sha256: 652936566082828106da55fa0d4a611f444bd550eed4e4c90f730808cc84d98a

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

FactoryGirl.define do
  factory :job_template do |f|
    f.sequence(:name) { |n| "Job template #{n}" }
    f.template 'id'
    f.provider_type 'Ssh'

    trait :with_input do
      after(:build) do |template, evaluator|
        template.template_inputs << FactoryGirl.build(:template_input)
      end
    end
  end

  factory :template_input do |f|
    f.sequence(:name) { |n| "Template input #{n}" }
    f.input_type TemplateInput::TYPES.keys.first
  end

  factory :targeting do |f|
    search_query "name = foo"
    targeting_type "static_query"
    user
  end

  factory :job_invocation do |f|
    targeting
    f.sequence(:job_name) { |n| "Job name #{n}" }
    trait :with_template do
      after(:build) do |invocation, evaluator|
        invocation.template_invocations << FactoryGirl.build(:template_invocation)
      end

    end
  end

  factory :remote_execution_provider do |f|
    f.sequence(:name) { |n| "Provider #{n}" }
  end

  factory :template_invocation do |f|
    job_invocation
    association :template, :factory => :job_template
  end

  factory :template_invocation_input_value do |f|
    f.sequence(:value) { |n| "Input Value #{n}" }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_remote_execution-0.0.6 test/factories/foreman_remote_execution_factories.rb
foreman_remote_execution-0.0.5 test/factories/foreman_remote_execution_factories.rb
foreman_remote_execution-0.0.4 test/factories/foreman_remote_execution_factories.rb
foreman_remote_execution-0.0.3 test/factories/foreman_remote_execution_factories.rb
foreman_remote_execution-0.0.2 test/factories/foreman_remote_execution_factories.rb
foreman_remote_execution-0.0.1 test/factories/foreman_remote_execution_factories.rb