Skip to content

Commit

Permalink
Make the migration matcher fail if passed a bad filename
Browse files Browse the repository at this point in the history
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
daemianmack committed Nov 23, 2012
1 parent ccd97c3 commit 9b5229b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/generator_spec/matcher.rb
Expand Up @@ -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
end

check_contents(file_name)
Expand Down

0 comments on commit 9b5229b

Please sign in to comment.