lib/rails/generators/test_case.rb in railties-3.0.0.beta3 vs lib/rails/generators/test_case.rb in railties-3.0.0.beta4
- old
+ new
@@ -187,9 +187,21 @@
assert content =~ /def #{method}(\(.+\))?(.*?)\n end/m, "Expected to have method #{method}"
yield $2.strip if block_given?
end
alias :assert_method :assert_instance_method
+ # Asserts the given field name gets translated to an attribute type
+ # properly.
+ #
+ # assert_field_type :date, :date_select
+ #
+ def assert_field_type(name, attribute_type)
+ assert_equal(
+ Rails::Generators::GeneratedAttribute.new('test', name.to_s).field_type,
+ attribute_type
+ )
+ end
+
# Runs the generator configured for this class. The first argument is an array like
# command line arguments:
#
# class AppGeneratorTest < Rails::Generators::TestCase
# tests AppGenerator