Class: RSpecKickstarter::ERBFactory

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

Overview

ERB instance provider

Instance Method Summary collapse

Constructor Details

#initialize(custom_template) ⇒ ERBFactory

Returns a new instance of ERBFactory.



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

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



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

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



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

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