Class: Cucumber::FeatureGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Generators::FeatureBase
Defined in:
lib/generators/cucumber/feature/feature_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Generators::FeatureBase

#create_directory, #create_feature_file, #create_steps_file, #create_support_file

Instance Attribute Details

#named_argsObject (readonly)

Returns the value of attribute named_args.



11
12
13
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 11

def named_args
  @named_args
end

Class Method Details



24
25
26
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 24

def self.banner
  "#{$0} cucumber:feature ModelName [field:type, field:type]"
end

.gem_rootObject



28
29
30
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 28

def self.gem_root
  File.expand_path("../../../../../", __FILE__)
end

.source_rootObject



32
33
34
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 32

def self.source_root
  File.join(gem_root, 'templates', 'feature')
end

Instance Method Details

#generateObject



17
18
19
20
21
22
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 17

def generate
  create_directory
  create_feature_file
  create_steps_file
  create_support_file
end

#parse_fieldsObject



13
14
15
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 13

def parse_fields
  @named_args = @fields.nil? ? [] : @fields.map { |arg| NamedArg.new(arg) }
end