Class: ChefSpec::Stubs::Registry

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/chefspec/stubs/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry


14
15
16
# File 'lib/chefspec/stubs/registry.rb', line 14

def initialize
  reset!
end

Instance Attribute Details

#stubsHash<Symbol, Array<SearchStub>>


12
13
14
# File 'lib/chefspec/stubs/registry.rb', line 12

def stubs
  @stubs
end

Instance Method Details

#register(stub) ⇒ Object


22
23
24
25
# File 'lib/chefspec/stubs/registry.rb', line 22

def register(stub)
  @stubs.insert(0, stub)
  stub
end

#reset!Object


18
19
20
# File 'lib/chefspec/stubs/registry.rb', line 18

def reset!
  @stubs = []
end

#stub_for(*args) ⇒ Object

Raises:

  • (ArgumentError)

27
28
29
# File 'lib/chefspec/stubs/registry.rb', line 27

def stub_for(*args)
  raise ArgumentError, '#stub_for is an abstract function'
end