Sha256: fd6a6c79549a9bfc2eb6712a29a5704327c1493687a71947682ca34bd2d33fbd

Contents?: true

Size: 766 Bytes

Versions: 10

Compression:

Stored size: 766 Bytes

Contents

module ForemanAnsible
  module PluginFixtures
    FIXTURE_MAPPING = {
      :ansible_permissions => :permissions
    }.freeze

    def self.add_fixtures(new_fixture_path)
      FileUtils.cp(Dir.glob("#{Rails.root}/test/fixtures/*"), new_fixture_path)
      copy_plugin_fixtures new_fixture_path
    end

    def self.copy_plugin_fixtures(new_fixture_path)
      FIXTURE_MAPPING.each do |key, value|
        fixture_path = "#{ForemanAnsible::Engine.root}/test/fixtures/#{key}.yml"
        break unless File.exist?(fixture_path)
        File.open("#{new_fixture_path}/#{value}.yml", 'a') do |file|
          File.open(fixture_path, 'r').each do |line|
            next if line =~ /---/
            file.write line
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_ansible-1.4.5 test/support/fixture_support.rb
foreman_ansible-1.4.3 test/support/fixture_support.rb
foreman_ansible-1.4.2 test/support/fixture_support.rb
foreman_ansible-1.4.1 test/support/fixture_support.rb
foreman_ansible-1.4.0 test/support/fixture_support.rb
foreman_ansible-1.3.1 test/support/fixture_support.rb
foreman_ansible-1.3.0 test/support/fixture_support.rb
foreman_ansible-1.2.1 test/support/fixture_support.rb
foreman_ansible-1.2 test/support/fixture_support.rb
foreman_ansible-1.1 test/support/fixture_support.rb