Sha256: 8dfb17ff0374bec5d258a4f9ed9ae62948740de5ed0768663e28e213b5f3b1cf

Contents?: true

Size: 920 Bytes

Versions: 34

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

require 'avm/file_formats/search_formatter'
require 'eac_ruby_utils/core_ext'

RSpec.shared_examples 'avm_file_formats_with_fixtures' do |the_spec_file|
  include_examples 'source_target_fixtures', the_spec_file

  def format_files_in_directory(target_dir)
    Avm::FileFormats::SearchFormatter
      .new([target_dir], recursive: true, apply: true, verbose: false)
      .run
  end

  def source_data(source_file)
    dir = temp_dir
    source_basename = source_file_basename_without_source_extname(source_file)
    source_path = dir.join(source_basename)
    FileUtils.cp(source_file, source_path)
    format_files_in_directory(dir)
    source_path.read
  end

  def source_file_basename_without_source_extname(source_file)
    source_file.to_pathname.basename_sub { |b| b.to_path.gsub('.source', '') }.basename
  end

  def target_data(target_file)
    File.read(target_file)
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
avm-0.94.1 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.98.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.94.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.94.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.93.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.92.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.92.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.91.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.90.1 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.87.1 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.90.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.87.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.89.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.86.12 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.88.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.86.11 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.87.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.86.8 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.86.2 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.86.7 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb