class Souschef::Template::Chefspec

Create spechelper for Chefspec

Public Class Methods

new(opts) click to toggle source
Calls superclass method Souschef::Template::Base::new
# File lib/souschef/template/chefspec.rb, line 5
def initialize(opts)
  super(opts)
end

Public Instance Methods

create() click to toggle source

Public - Create spec/spec_helper.rb file

cookbook - String Cookbook name

Returns nil

# File lib/souschef/template/chefspec.rb, line 13
def create
  spec_dir = File.join(@path, 'spec')

  tmpl = ERB.new(load_erb_file('chefspec/spec_helper.rb'))
  data = tmpl.result(binding)

  create_spec_dir(spec_dir) unless File.directory?(spec_dir)

  info 'Creating Chefspec helper'
  write_file(cookbook_file_path('spec/spec_helper.rb'), data)
end