Sha256: 34e75be1327557091c1f0d166b99069be5e8d364b194c3a1fa8a9f5753c6474e

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module Helpers
  class JobHelperTest < ActionView::TestCase
    let(:helper) { ::Helpers::JobHelper }

    let(:job_template) do
      FactoryBot.create(:job_template, template: 'echo "1"', job_category: 'leapp',
        provider_type: 'SSH', name: 'Leapp preupgrade')
    end
    let(:job_invocation) { FactoryBot.create(:job_invocation) }

    describe 'correct_feature?' do
      setup do
        RemoteExecutionFeature.find_by(label: 'leapp_preupgrade').update(job_template: job_template)
        FactoryBot.create(:template_invocation, template: job_template, job_invocation: job_invocation)
      end

      it 'correct feature' do
        assert helper.correct_feature?(job_invocation, 'leapp_preupgrade')
      end

      it 'wrong feature' do
        assert_not helper.correct_feature?(job_invocation, 'leapp_preupgrade2')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_leapp-2.0.3 test/unit/helpers/job_helper_test.rb
foreman_leapp-2.0.2 test/unit/helpers/job_helper_test.rb