Browse files

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

…tation

Otherwise it was matching "end" lines from blocks within the method body,
making tests such as the migration ones fail.
  • Loading branch information...
1 parent 61b528e commit 314e4bbaeacc91297689761308eba0d2fac29e16 @carlosantoniodasilva carlosantoniodasilva committed Dec 8, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/lib/rails/generators/test_case.rb
View
4 railties/lib/rails/generators/test_case.rb
@@ -163,8 +163,8 @@ def assert_class_method(method, content, &block)
# 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

1 comment on commit 314e4bb

@frodsan

❤️

Please sign in to comment.