Class: TestingMachine::FeatureGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/testing_machine/feature_generator.rb

Instance Method Summary collapse

Instance Method Details

#manifestObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/testing_machine/feature_generator.rb', line 13

def manifest
  ARGV.map do |name|
    @name          = name.gsub(/[A-Z]/) {|x| '_' + x.downcase }.sub(/^_/,'').gsub(/\/_/,'/')
    spec_filename  = "testingmachine/features/#{@name}_spec.rb"
    table_filename = "testingmachine/tables/#{@name}.table"
    @const_name    = File.basename(@name).capitalize.gsub(/_(\w)/) { $1.capitalize }

    empty_directory File.dirname(spec_filename)
    template "feature_spec.rb", spec_filename
    template "table.table", table_filename
  end
end