Fix method assertion ensuring it will match "end" with the same indentation

Otherwise it was matching "end" lines from blocks within the method body,
making tests such as the migration ones fail.
This commit is contained in:
Carlos Antonio da Silva 2012-12-08 19:22:09 -02:00
parent 61b528ede0
commit 314e4bbaea
1 changed files with 2 additions and 2 deletions

View File

@ -163,8 +163,8 @@ module Rails
# end
# end
def assert_instance_method(method, content)
assert content =~ /def #{method}(\(.+\))?(.*?)\n\s+end/m, "Expected to have method #{method}"
yield $2.strip if block_given?
assert content =~ /(\s+)def #{method}(\(.+\))?(.*?)\n\1end/m, "Expected to have method #{method}"
yield $3.strip if block_given?
end
alias :assert_method :assert_instance_method