Class: RSpecKickstarter::ERBFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_kickstarter/erb_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(custom_template) ⇒ ERBFactory

Returns a new instance of ERBFactory.



13
14
15
# File 'lib/rspec_kickstarter/erb_factory.rb', line 13

def initialize(custom_template)
  @custom_template = custom_template
end

Instance Method Details

#get_instance_for_appending(rails_mode, target_path) ⇒ Object

Returns ERB instance for appeding lacking tests



28
29
30
31
# File 'lib/rspec_kickstarter/erb_factory.rb', line 28

def get_instance_for_appending(rails_mode, target_path)
  template = get_erb_template(@custom_template, false, rails_mode, target_path)
  ERB.new(template, nil, '-', '_additional_spec_code')
end

#get_instance_for_new_spec(rails_mode, target_path) ⇒ Object

Returns ERB instance for creating new spec



20
21
22
23
# File 'lib/rspec_kickstarter/erb_factory.rb', line 20

def get_instance_for_new_spec(rails_mode, target_path)
  template = get_erb_template(@custom_template, true, rails_mode, target_path)
  ERB.new(template, nil, '-', '_new_spec_code')
end