Sha256: 8478df2a6a8bad7724a6f86edc7df00b6e4baff27a0be0d60d01a9e2e1897525

Contents?: true

Size: 859 Bytes

Versions: 6

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

require 'eac_fs/comparator'
require 'eac_ruby_utils/core_ext'

RSpec.shared_examples 'avm_source_generated' do |spec_file, stereotype, options = {}|
  include_context 'spec_paths', spec_file
  block_on_each_source = options.delete(:block_on_each_source)

  spec_paths_controller.fixtures_directory.children.select(&:directory?).each do |target_dir|
    context "when target is \"#{target_dir.basename}\"" do
      let(:source) { avm_source(stereotype, options.merge(target_basename: target_dir.basename)) }

      it do
        expect(fs_comparator.build(source.path)).to eq(fs_comparator.build(target_dir))
      end

      instance_exec(&block_on_each_source) if block_on_each_source
    end
  end

  # @return [EacFs::Comparato]
  def fs_comparator
    EacFs::Comparator.new.rename_file('.gitignore', '_gitignore')
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
avm-0.94.0 lib/avm/rspec/shared_examples/avm_source_generated.rb
eac_tools-0.94.0 sub/avm/lib/avm/rspec/shared_examples/avm_source_generated.rb
avm-0.93.0 lib/avm/rspec/shared_examples/avm_source_generated.rb
eac_tools-0.92.0 sub/avm/lib/avm/rspec/shared_examples/avm_source_generated.rb
avm-0.92.0 lib/avm/rspec/shared_examples/avm_source_generated.rb
eac_tools-0.91.0 sub/avm/lib/avm/rspec/shared_examples/avm_source_generated.rb