Sha256: 8704a60e52420b30ed0d54203ad78fd67035c3cedee96f1e23a55728f47b777d

Contents?: true

Size: 1.32 KB

Versions: 8

Compression:

Stored size: 1.32 KB

Contents

# This calls the main test_helper in Foreman-core
require 'test_helper'

# Add plugin to FactoryBot's paths
FactoryBot.definition_file_paths << "#{ForemanTasks::Engine.root}/test/factories"
FactoryBot.definition_file_paths << "#{ForemanRemoteExecution::Engine.root}/test/factories"
FactoryBot.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
# FactoryBot.definition_file_paths << "#{Katello::Engine.root}/test/factories"
FactoryBot.reload

module FolderIsolation
  extend ActiveSupport::Concern

  included do
    setup do
      @tmpdir = Dir.mktmpdir(self.class.name.underscore)

      ForemanInventoryUpload.stubs(:base_folder).returns(@tmpdir)
      ForemanInventoryUpload.instance_variable_set(:@outputs_folder, nil)
      ForemanInventoryUpload.instance_variable_set(:@uploads_folders, nil)
    end

    teardown do
      FileUtils.remove_entry @tmpdir
      ForemanInventoryUpload.unstub(:base_folder)
    end
  end
end

module KatelloLocationFix
  extend ActiveSupport::Concern

  included do
    setup do
      FactoryBot.create(:setting, name: 'default_location_subscribed_hosts')
      FactoryBot.create(:setting, name: 'default_location_puppet_content')
      Setting[:default_location_subscribed_hosts] = Location.first.title
      Setting[:default_location_puppet_content] = Location.first.title
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.32 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.29 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.28 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.26 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.25 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.24.1 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.24 test/test_plugin_helper.rb
foreman_rh_cloud-3.0.23 test/test_plugin_helper.rb