Sha256: 2bfede4ab59a3c1b072169f0e066ab83ce10af9858feaab887d6f8eade5608a9
Contents?: true
Size: 1.41 KB
Versions: 4
Compression:
Stored size: 1.41 KB
Contents
def create_feature_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Feature file_path = File.join(FileUtils.pwd, 'features', 'specifications', "#{name.downcase}.feature") # Thor creates a file based on the templates/feature.tt template template('feature', file_path, opts) end def create_steps_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Step file_path = File.join( FileUtils.pwd, 'features', 'steps_definitions', "#{name.downcase}_steps.rb" ) # Thor creates a file based on the templates/steps.tt template template('steps', file_path, opts) end def create_page_file(name) # options used to generate the file in the template function opts = { name: camelize(name) } # Thor creates a file based on the templates/page.tt template template('page', File.join( FileUtils.pwd, 'features', 'pages', "#{name.downcase}_page.rb"), opts) end def camelize(string) camelized = '' string.split('_').each do |s| camelized += s.capitalize end camelized end def in_root_project_folder? # Looks if the user is in the root folder of the project if !Dir.exist?(File.join(FileUtils.pwd, 'features', 'specifications')) puts 'Please run this command on the root folder of the project' exit 1 end true end
Version data entries
4 entries across 4 versions & 1 rubygems