class StepsTemplator

Constants

VALID_TYPES

Attributes

file[R]
generator[R]

Public Class Methods

new(generator, user, file) click to toggle source
# File lib/generators/feature/steps_templator.rb, line 8
def initialize(generator, user, file)
  @generator = generator
  @user = user
  @file = file
end

Public Instance Methods

create_methods(template) click to toggle source
# File lib/generators/feature/steps_templator.rb, line 14
def create_methods(template)
  generator.prepend_to_file file do
    render File.join('step_definitions', template)
  end if File.exists? file
end
create_step(type, template) click to toggle source
# File lib/generators/feature/steps_templator.rb, line 20
def create_step(type, template)
  fail "type '#{type}' must be one of #{VALID_TYPES}" unless VALID_TYPES.include? type
  generator.insert_into_file file, after: "### #{type.to_s.upcase} ###\n\n" do
    render File.join('step_definitions', template)
  end if File.exists? file
end