Class: FeatureGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_feature_fileObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/feature_generator.rb', line 9

def create_feature_file
  if options['language'] == 'pt'
    template = "Funcionalidade: #{file_name}
    Como [stakeholder]
    Para que eu [funcionalidade]
    Eu quero [finalidade]\n"
  else
    template = "Feature: #{file_name}
    As a [stakeholder]
    So that I [functionality]
    I want to [goal]\n"
  end
  if options['folder']
    create_file "features/#{options['folder']}/#{file_name}.feature", "#language: #{options['language']}\n#encoding: utf-8\n\n#{template}"
  else
    create_file "features/#{file_name}.feature", "#language: #{options['language']}\n#encoding: utf-8\n\n@#{file_name}\n#{template}"
  end
end

#create_feature_steps_fileObject



28
29
30
31
32
33
34
# File 'lib/generators/feature_generator.rb', line 28

def create_feature_steps_file
  if options['folder']
    create_file "features/step_definitions/#{options['folder']}/#{file_name}_steps.rb","# This is the steps file referred to #{file_name} feature\n# Place your code relative to that feature here"
  else
    create_file "features/step_definitions/#{file_name}_steps.rb","# This is the steps file referred to #{file_name} feature\n# Place your code relative to that feature here"
  end
end