run_generator

run_generator(args=self.default_arguments, config={}) Instance Public methods Runs the generator configured for this class. The first argument is an array like command line arguments: class AppGeneratorTest < Rails::Generators::TestCase tests AppGenerator destination File.expand_path("../tmp", File.dirname(__FILE__)) teardown :cleanup_destination_root test "database.yml is not created when skipping Active Record" do run_generator %w(myapp --skip-active-record) a

generator

generator(args=self.default_arguments, options={}, config={}) Instance Public methods Instantiate the generator.

create_generated_attribute

create_generated_attribute(attribute_type, name = 'test', index = nil) Instance Public methods Create a Rails::Generators::GeneratedAttribute by supplying the attribute type and, optionally, the attribute name: create_generated_attribute(:string, 'name')

tests

tests(klass) Instance Public methods Sets which generator should be tested: tests AppGenerator

destination

destination(path) Instance Public methods Sets the destination of generator files: destination File.expand_path("../tmp", File.dirname(__FILE__))

arguments

arguments(array) Instance Public methods Sets default arguments on generator invocation. This can be overwritten when invoking it. arguments %w(app_name --skip-active-record)

assert_no_migration

assert_no_migration(relative) Instance Public methods Asserts a given migration does not exist. You need to supply an absolute path or a path relative to the configured destination: assert_no_migration "db/migrate/create_products.rb"

assert_no_file

assert_no_file(relative) Instance Public methods Asserts a given file does not exist. You need to supply an absolute path or a path relative to the configured destination: assert_no_file "config/random.rb" assert_no_directory

assert_no_directory

assert_no_directory(relative) Instance Public methods Alias for: assert_no_file

assert_migration

assert_migration(relative, *contents, &block) Instance Public methods Asserts a given migration exists. You need to supply an absolute path or a path relative to the configured destination: assert_migration "db/migrate/create_products.rb" This method manipulates the given path and tries to find any migration which matches the migration name. For example, the call above is converted to: assert_file "db/migrate/003_create_products.rb" Consequently, #assert_migration accepts the