Class: Mocha::Central

Inherits:
Object show all
Defined in:
lib/mocha/central.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCentral

Returns a new instance of Central.



7
8
9
# File 'lib/mocha/central.rb', line 7

def initialize
  self.stubba_methods = []
end

Instance Attribute Details

#stubba_methodsObject

Returns the value of attribute stubba_methods.



5
6
7
# File 'lib/mocha/central.rb', line 5

def stubba_methods
  @stubba_methods
end

Instance Method Details

#stub(method) ⇒ Object



11
12
13
14
15
16
# File 'lib/mocha/central.rb', line 11

def stub(method)
  unless stubba_methods.include?(method)
    method.stub 
    stubba_methods.push(method)
  end
end

#unstub_allObject



18
19
20
21
22
23
# File 'lib/mocha/central.rb', line 18

def unstub_all
  while stubba_methods.length > 0
    method = stubba_methods.pop
    method.unstub
  end
end