lib/ammeter/rspec/generator/matchers/be_a_migration.rb in ammeter-0.2.9 vs lib/ammeter/rspec/generator/matchers/be_a_migration.rb in ammeter-1.0.0
- old
+ new
@@ -1,8 +1,9 @@
RSpec::Matchers.define :be_a_migration do
match do |file_path|
dirname, file_name = File.dirname(file_path), File.basename(file_path)
- if file_name.match(/\d+_.*\.rb/)
+
+ if file_name =~ /\d+_.*\.rb/
migration_file_path = file_path
else
migration_file_path = Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{file_name}$/).first
end
File.exist?(migration_file_path)