Sha256: 62738448263fa1e16907d48da1042103984dd040398b6f3e31f82c1749cb54e9

Contents?: true

Size: 1.08 KB

Versions: 98

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

98 entries across 98 versions & 1 rubygems

Version Path
foreman_remote_execution-10.1.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-12.0.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.1.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-11.1.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-11.1.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.1.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-8.3.3 test/functional/job_templates_controller_test.rb
foreman_remote_execution-8.3.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-11.0.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.7 test/functional/job_templates_controller_test.rb
foreman_remote_execution-8.3.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.6 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.5 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.4 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.3 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.2 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.1 test/functional/job_templates_controller_test.rb
foreman_remote_execution-10.0.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-8.3.0 test/functional/job_templates_controller_test.rb
foreman_remote_execution-9.1.0 test/functional/job_templates_controller_test.rb