Class: MotionSpec::Mocks

Inherits:
Object show all
Defined in:
lib/motion-spec/mock/mocks.rb

Overview

A class to track the mocks and proxies that have been satisfied

Class Method Summary collapse

Class Method Details

.add(mock) ⇒ Object



10
11
12
13
14
# File 'lib/motion-spec/mock/mocks.rb', line 10

def add(mock)
  @mocks ||= []
  Counter[:requirements] += 1
  @mocks << mock
end

.clear!Object



24
25
26
# File 'lib/motion-spec/mock/mocks.rb', line 24

def clear!
  @mocks = []
end

.failuresObject



20
21
22
# File 'lib/motion-spec/mock/mocks.rb', line 20

def failures
  @mocks
end

.sizeObject



6
7
8
# File 'lib/motion-spec/mock/mocks.rb', line 6

def size
  @mocks ? 0 : @mocks.size
end

.verify(mock) ⇒ Object



16
17
18
# File 'lib/motion-spec/mock/mocks.rb', line 16

def verify(mock)
  @mocks.delete(mock)
end