Sha256: 1713b9e42100c2ac4409f43b945d1e59fe81ee81fdd4ff435482b990f60e6149

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

# Checks if a directory has a migration from given source file.
RSpec::Matchers.define :have_migration_from do |source|
  match do |dir|

    # Search file that matches source with any timestamp.
    basename = File.basename(source, ".rb")[14..-1]
    sample   = "*#{ basename }.uuids.rb"
    search   = File.join(dir, sample)
    file     = Dir[search].first

    # Check the file exists and has required content.
    expect(file).not_to be_nil
    expect(File.read file).to eq File.read source
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uuids-1.4.1 spec/support/development/matchers/migrations.rb