Class: Cucumber::FeatureGenerator

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#named_argsObject (readonly)

Returns the value of attribute named_args.



9
10
11
# File 'lib/generators/cucumber/feature/feature_generator.rb', line 9

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

Instance Method Details

#generateObject



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

def generate
  empty_directory 'features/step_definitions'
  template 'feature.erb', "features/manage_#{plural_name}.feature"
  template 'steps.erb', "features/step_definitions/#{singular_name}_steps.rb"
  gsub_file 'features/support/paths.rb', /'\/'/mi do |match|
    "#{match}\n    when /the new #{singular_name} page/\n      new_#{singular_name}_path\n"
  end
end

#parse_fieldsObject



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

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