spec/support/development/matchers/migrations.rb in uuids-1.4.1 vs spec/support/development/matchers/migrations.rb in uuids-1.4.2

- old
+ new

@@ -1,15 +1,16 @@ -# Checks if a directory has a migration from given source file. -RSpec::Matchers.define :have_migration_from do |source| - match do |dir| +require_relative "../helpers/sandbox" - # Search file that matches source with any timestamp. +# 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(dir, sample) + search = File.join(sandbox, folder, sample) file = Dir[search].first - # Check the file exists and has required content. + # 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