Sha256: 71d4d0ad217fa0b726d43e059178ab59d653b32292c0ddbeb54a2d6d92ea1349

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_rh_cloud-4.0.25 test/test_plugin_helper.rb
foreman_rh_cloud-4.0.24.1 test/test_plugin_helper.rb
foreman_rh_cloud-4.0.24 test/test_plugin_helper.rb
foreman_rh_cloud-4.0.23 test/test_plugin_helper.rb