Browse files

Make the migration matcher fail if passed a bad filename

If a migration file is found not to exist, its name is set to nil, and this is thrown up the stack with a failure at matcher.rb#L46. 

This then gets interpreted as a successful match at matcher.rb#L129.

Avoid this by returning the requested @name to trigger a failed match.
  • Loading branch information...
1 parent ccd97c3 commit 9b5229be0bbc9cd9a31a0dce2b44aa7b4af07754 @daemianmack daemianmack committed Nov 23, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/generator_spec/matcher.rb
2 lib/generator_spec/matcher.rb
@@ -43,7 +43,7 @@ def matches?(root)
file_name = migration_file_name(root, @name)
unless file_name && file_name.exist?
- throw :failure, file_name
+ throw :failure, @name

0 comments on commit 9b5229b

Please sign in to comment.