Sha256: cefd5d45a2379198a888ae95683fe11be9c73ad5ac561b58ab9a4cb17d92dca9

Contents?: true

Size: 977 Bytes

Versions: 109

Compression:

Stored size: 977 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/source_target_fixtures'
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

109 entries across 109 versions & 2 rubygems

Version Path
avm-0.83.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.82.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.82.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.81.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.80.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.81.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.79.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.80.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.78.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.77.1 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.77.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.76.1 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.76.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.75.2 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.75.1 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.75.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.74.1 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.74.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
avm-0.79.0 lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb
eac_tools-0.73.0 sub/avm/lib/avm/rspec/shared_examples/avm_file_formats_with_fixtures.rb