module Rails::Generators::Testing::Assertions

def assert_instance_method(method, content)

end
end
assert_match(/Product\.all/, index)
assert_instance_method :index, controller do |index|
assert_file "app/controllers/products_controller.rb" do |controller|

it yields the content of the method.
Asserts the given method exists in the given content. When a block is given,
def assert_instance_method(method, content)
  assert content =~ /(\s+)def #{method}(\(.+\))?(.*?)\n\1end/m, "Expected to have method #{method}"
  assert_nothing_raised { yield $3.strip } if block_given?
end