diff options
Diffstat (limited to 'railties/test/generators/generators_test_helper.rb')
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 662646fbff..7c58c7b64e 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -73,4 +73,13 @@ class GeneratorsTestCase < Test::Unit::TestCase migration = Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{file_name}.rb$/).first File.basename(migration) if migration end + + def assert_class_method_for(content, method, &block) + assert_instance_method_for content, "self.#{method}", &block + end + + def assert_instance_method_for(content, method) + assert_match /def #{method}(.*?)end/m, content + yield content.match(/def #{method}(.*?)end/m)[1] + end end |