lib/rails/generators/test_case.rb in railties-3.1.0 vs lib/rails/generators/test_case.rb in railties-3.1.1.rc1
- old
+ new
@@ -79,11 +79,11 @@
#
# Finally, when a block is given, it yields the file content:
#
# assert_file "app/controller/products_controller.rb" do |controller|
# assert_instance_method :index, content do |index|
- # assert_match /Product\.all/, index
+ # assert_match(/Product\.all/, index)
# end
# end
#
def assert_file(relative, *contents)
absolute = File.expand_path(relative, destination_root)
@@ -146,11 +146,11 @@
# class methods inside (class << self), only class methods which starts with "self.".
# When a block is given, it yields the content of the method.
#
# assert_migration "db/migrate/create_products.rb" do |migration|
# assert_class_method :up, migration do |up|
- # assert_match /create_table/, up
+ # assert_match(/create_table/, up)
# end
# end
#
def assert_class_method(method, content, &block)
assert_instance_method "self.#{method}", content, &block
@@ -159,10 +159,10 @@
# Asserts the given method exists in the given content. When a block is given,
# it yields the content of the method.
#
# assert_file "app/controller/products_controller.rb" do |controller|
# assert_instance_method :index, content do |index|
- # assert_match /Product\.all/, index
+ # assert_match(/Product\.all/, index)
# end
# end
#
def assert_instance_method(method, content)
assert content =~ /def #{method}(\(.+\))?(.*?)\n end/m, "Expected to have method #{method}"