Exception: ChefSpec::Error::NotStubbed
- Inherits:
-
ChefSpecError
- Object
- StandardError
- ChefSpecError
- ChefSpec::Error::NotStubbed
- Defined in:
- lib/chefspec/errors.rb
Direct Known Subclasses
CommandNotStubbed, DataBagItemNotStubbed, DataBagNotStubbed, SearchNotStubbed
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NotStubbed
constructor
A new instance of NotStubbed.
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( = {}) 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(*[:args]).and_return("...").signature signature = "#{type}(#{[:args].map(&:inspect).join(", ")})" super({ type: type, signature: signature, stub: stub, _template: :not_stubbed, }.merge()) end |