Skip to content

Commit 0e027f4

Browse files
author
Francesco Rodriguez
committed
Fix #assert_instance_method to also assert indented methods
1 parent 69163cc commit 0e027f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

railties/lib/rails/generators/test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def assert_class_method(method, content, &block)
163163
# end
164164
# end
165165
def assert_instance_method(method, content)
166-
assert content =~ /def #{method}(\(.+\))?(.*?)\n end/m, "Expected to have method #{method}"
166+
assert content =~ /def #{method}(\(.+\))?(.*?)\n\s+end/m, "Expected to have method #{method}"
167167
yield $2.strip if block_given?
168168
end
169169
alias :assert_method :assert_instance_method

0 commit comments

Comments
 (0)