Exception: ChefSpec::Error::NotStubbed

Inherits:
ChefSpecError show all
Defined in:
lib/chefspec/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ NotStubbed

Returns a new instance of NotStubbed.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/chefspec/errors.rb', line 15

def initialize(options = {})
  name  = self.class.name.to_s.split("::").last
  type  = Util.underscore(name).gsub("_not_stubbed", "")
  klass = Stubs.const_get(name.gsub("NotStubbed", "") + "Stub")
  stub  = klass.new(*options[:args]).and_return("...").signature

  signature = "#{type}(#{options[:args].map(&:inspect).join(", ")})"

  super({
    type:      type,
    signature: signature,
    stub:      stub,
    _template: :not_stubbed,
  }.merge(options))
end