From 0e027f4fe31b652baf9a845a552f3d99fd3ec10d Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sat, 8 Dec 2012 09:44:45 -0500 Subject: Fix #assert_instance_method to also assert indented methods --- railties/lib/rails/generators/test_case.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index 24308dcf6c..01e0e66d89 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -163,7 +163,7 @@ module Rails # end # end def assert_instance_method(method, content) - assert content =~ /def #{method}(\(.+\))?(.*?)\n end/m, "Expected to have method #{method}" + assert content =~ /def #{method}(\(.+\))?(.*?)\n\s+end/m, "Expected to have method #{method}" yield $2.strip if block_given? end alias :assert_method :assert_instance_method -- cgit v1.2.3