Class: Mocks::Mock
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Abstract
included
Constructor Details
#initialize ⇒ Mock
Returns a new instance of Mock.
13
14
15
|
# File 'lib/mocks/mock.rb', line 13
def initialize
@mock_calls = []
end
|
Instance Attribute Details
#mock_calls ⇒ Object
Returns the value of attribute mock_calls.
11
12
13
|
# File 'lib/mocks/mock.rb', line 11
def mock_calls
@mock_calls
end
|
Instance Method Details
#mock_add(elt) ⇒ Object
33
34
35
|
# File 'lib/mocks/mock.rb', line 33
def mock_add ( elt )
@mock_calls << elt unless @mock_calls.frozen?
end
|
#mock_args ⇒ Object
29
30
31
|
# File 'lib/mocks/mock.rb', line 29
def mock_args
@mock_calls.map { |call| call.args }
end
|
#mock_calls_array ⇒ Object
25
26
27
|
# File 'lib/mocks/mock.rb', line 25
def mock_calls_array
@mock_calls.map { |call| call.to_a }
end
|
#mock_clear ⇒ Object
41
42
43
|
# File 'lib/mocks/mock.rb', line 41
def mock_clear
@mock_calls.clear
end
|
#mock_freeze ⇒ Object
37
38
39
|
# File 'lib/mocks/mock.rb', line 37
def mock_freeze
@mock_calls.freeze
end
|
#mock_recall(anObject) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/mocks/mock.rb', line 17
def mock_recall ( anObject )
result = nil
@mock_calls.each do |call|
result = call.recall anObject
end
result
end
|
#mock_size ⇒ Object
45
46
47
|
# File 'lib/mocks/mock.rb', line 45
def mock_size
@mock_calls.size
end
|