Sha256: 23e6b478846f2198f370673c316f9f6ac3380e9dbff130f83a9caeb5a2b81d67

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 KB

Contents

require 'test_plugin_helper'

describe TemplateInvocationInputValue do
  let(:template) { FactoryGirl.build(:job_template, :template => 'service restart <%= input("service_name") -%>') }
  let(:renderer) { InputTemplateRenderer.new(template) }
  let(:job_invocation) { FactoryGirl.create(:job_invocation) }
  let(:template_invocation) { FactoryGirl.build(:template_invocation, :template => template) }
  let(:result) { renderer.render }

  context 'with selectable options' do
    before do
      result # let is lazy
      template.template_inputs << FactoryGirl.build(:template_input, :name => 'service_name', :input_type => 'user',
                                                                     :required => true, :options => "foreman\nhttpd")
    end

    it 'fails with an invalid option' do
      refute_valid FactoryGirl.build(:template_invocation_input_value, :template_invocation => template_invocation,
                                                                       :template_input => template.template_inputs.first,
                                                                       :value => 'sendmail')
    end

    it 'succeeds with valid option' do
      assert_valid FactoryGirl.build(:template_invocation_input_value, :template_invocation => template_invocation,
                                                                       :template_input => template.template_inputs.first,
                                                                       :value => 'foreman')
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
foreman_remote_execution-1.2.1 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-1.2.0 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-1.1.1 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-1.1.0 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-1.0.0 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.3.2 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.3.1 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.3.0 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.2.3 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.2.2 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.2.1 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.1.2 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.1.1 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.1.0 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.0.10 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.0.8 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.0.7 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.0.6 test/unit/template_invocation_input_value_test.rb
foreman_remote_execution-0.0.5 test/unit/template_invocation_input_value_test.rb