1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #8461 from frodsan/fix_assert_method_generators

Fix #assert_instance_method to also assert indented methods
This commit is contained in:
Carlos Antonio da Silva 2012-12-08 08:00:52 -08:00
commit 49295e72d3

View file

@ -163,7 +163,7 @@ module Rails
# end # end
# end # end
def assert_instance_method(method, content) 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? yield $2.strip if block_given?
end end
alias :assert_method :assert_instance_method alias :assert_method :assert_instance_method