Sha256: d4c72c6643048c7c82db1ee1e6702d8a61f5b0b0ac328b572eca6931f7f0a511

Contents?: true

Size: 1.08 KB

Versions: 32

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

class JobTemplatesControllerTest < ActionController::TestCase
  context '#preview' do
    let(:template) { FactoryBot.create(:job_template) }
    let(:host) { FactoryBot.create(:host, :managed) }

    test 'should render a preview version of a template' do
      post :preview, params: { job_template: template.to_param, template: 'uptime' }, session: set_session_user
      assert_response :success
    end

    test 'should render a preview version of a template for a specific host' do
      post :preview, params: {
        job_template: template.to_param,
        template: '<%= @host.name %>',
        preview_host_id: host.id
      }, session: set_session_user
      assert_response :success
      assert_equal host.name, @response.body
    end

    test 'should render a error message when template has errors' do
      InputTemplateRenderer.any_instance.stubs(:render).returns(false)
      post :preview, params: { job_template: template.to_param }, session: set_session_user
      assert_response :not_acceptable
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
foreman_remote_execution-2.0.10 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.9 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.8 test/functional/job_templates_controller_test.rb
foreman_remote_execution-3.0.3 test/functional/job_templates_controller_test.rb
foreman_remote_execution-3.0.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.7 test/functional/job_templates_controller_test.rb
foreman_remote_execution-3.0.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-3.0.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.6 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.5 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.4 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.3 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-2.0.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-1.8.4 test/functional/job_templates_controller_test.rb
foreman_remote_execution-1.8.3 test/functional/job_templates_controller_test.rb
foreman_remote_execution-1.8.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-1.8.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-1.8.0 test/functional/job_templates_controller_test.rb