Exception: ChefSpec::Error::ChefSpecError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/chefspec/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ChefSpecError

Returns a new instance of ChefSpecError


4
5
6
7
8
9
10
11
# File 'lib/chefspec/errors.rb', line 4

def initialize(options = {})
  class_name = self.class.to_s.split('::').last
  filename   = options.delete(:_template) || Util.underscore(class_name)
  template   = ChefSpec.root.join('templates', 'errors', "#{filename}.erb")

  erb = Erubis::Eruby.new(File.read(template))
  super erb.evaluate(options)
end