diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-08 19:22:09 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-08 20:40:35 -0200 |
commit | 314e4bbaeacc91297689761308eba0d2fac29e16 (patch) | |
tree | a1ec711f0b1d667174cb16f0915208e1d48f3856 /railties | |
parent | 61b528ede052d5f73b83acf67e38b4f98e2b3992 (diff) | |
download | rails-314e4bbaeacc91297689761308eba0d2fac29e16.tar.gz rails-314e4bbaeacc91297689761308eba0d2fac29e16.tar.bz2 rails-314e4bbaeacc91297689761308eba0d2fac29e16.zip |
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.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/test_case.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/test_case.rb b/railties/lib/rails/generators/test_case.rb index 01e0e66d89..85a8914ccc 100644 --- a/railties/lib/rails/generators/test_case.rb +++ b/railties/lib/rails/generators/test_case.rb @@ -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 |