require_relative "../helpers/sandbox" # Checks if a migration is properly copied to sandbox subfolder RSpec::Matchers.define :have_copy_in_sandbox do |folder| match do |source| basename = File.basename(source, ".rb")[14..-1] sample = "*#{ basename }.uuids.rb" search = File.join(sandbox, folder, sample) file = Dir[search].first # Check whether file exists and has required content. expect(file).not_to be_nil expect(File.read file).to eq File.read source end end