Module: Mocks::Assertions
- Defined in:
- lib/mocks/assertions.rb
Instance Attribute Summary collapse
-
#mock_object ⇒ Object
Returns the value of attribute mock_object.
Instance Method Summary collapse
- #assert_empty_mock(comment = '') ⇒ Object
- #assert_last_mock(*ref) ⇒ Object
- #assert_last_mock_args(ref, comment = '') ⇒ Object
- #assert_last_mock_call(ref, comment = '') ⇒ Object
- #assert_mock(*ref) ⇒ Object
- #assert_mock_args(ref, comment = '') ⇒ Object
- #assert_mock_calls(ref, comment = '') ⇒ Object
- #assert_mock_size(size, comment = '') ⇒ Object
Instance Attribute Details
#mock_object ⇒ Object
Returns the value of attribute mock_object.
11 12 13 |
# File 'lib/mocks/assertions.rb', line 11 def mock_object @mock_object end |
Instance Method Details
#assert_empty_mock(comment = '') ⇒ Object
28 29 30 |
# File 'lib/mocks/assertions.rb', line 28 def assert_empty_mock ( comment='' ) assert_mock_calls [], (comment.empty?)? 'not empty' : comment end |
#assert_last_mock(*ref) ⇒ Object
32 33 34 |
# File 'lib/mocks/assertions.rb', line 32 def assert_last_mock ( *ref ) assert_equal(ref, mock_object.mock_calls.last.args) end |
#assert_last_mock_args(ref, comment = '') ⇒ Object
36 37 38 |
# File 'lib/mocks/assertions.rb', line 36 def assert_last_mock_args ( ref, comment='' ) assert_equal(ref, mock_object.mock_calls_array.last.args, comment) end |
#assert_last_mock_call(ref, comment = '') ⇒ Object
40 41 42 |
# File 'lib/mocks/assertions.rb', line 40 def assert_last_mock_call ( ref, comment='' ) assert_equal(ref, mock_object.mock_calls_array.last, comment) end |
#assert_mock(*ref) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/mocks/assertions.rb', line 13 def assert_mock ( *ref ) if ref.size == 1 and (f = ref.first).is_a? Array and f.first.is_a? Array ref = f end assert_equal(ref, mock_object.mock_args) end |
#assert_mock_args(ref, comment = '') ⇒ Object
24 25 26 |
# File 'lib/mocks/assertions.rb', line 24 def assert_mock_args ( ref, comment='' ) assert_equal(ref, mock_object.mock_args, comment) end |
#assert_mock_calls(ref, comment = '') ⇒ Object
20 21 22 |
# File 'lib/mocks/assertions.rb', line 20 def assert_mock_calls ( ref, comment='' ) assert_equal(ref, mock_object.mock_calls_array, comment) end |
#assert_mock_size(size, comment = '') ⇒ Object
44 45 46 |
# File 'lib/mocks/assertions.rb', line 44 def assert_mock_size ( size, comment='' ) assert_equal(size, mock_object.mock_size, comment) end |