File: test_generator.rb

package info (click to toggle)
ruby-generator-spec 0.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: ruby: 538; makefile: 5
file content (13 lines) | stat: -rw-r--r-- 406 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
class TestGenerator < Rails::Generators::Base
  argument :name, :type => :string
  class_option :test, :type => :boolean, :default => false
  source_root File.expand_path('../templates', __FILE__)
  
  def copy_initializer
    template "initializer.rb", "config/initializers/test.rb" if options[:test]
  end
  
  def create_migration
    template "migration.rb", "db/migrate/123_create_tests.rb"
  end
end