mocha 0.5.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/README +4 -4
  2. data/RELEASE +45 -0
  3. data/Rakefile +55 -33
  4. data/lib/mocha.rb +1 -0
  5. data/lib/mocha/any_instance_method.rb +24 -4
  6. data/lib/mocha/backtrace_filter.rb +17 -0
  7. data/lib/mocha/cardinality.rb +92 -0
  8. data/lib/mocha/central.rb +1 -9
  9. data/lib/mocha/change_state_side_effect.rb +19 -0
  10. data/lib/mocha/class_method.rb +25 -5
  11. data/lib/mocha/configuration.rb +60 -0
  12. data/lib/mocha/exception_raiser.rb +1 -1
  13. data/lib/mocha/expectation.rb +109 -48
  14. data/lib/mocha/expectation_error.rb +6 -6
  15. data/lib/mocha/expectation_list.rb +10 -14
  16. data/lib/mocha/in_state_ordering_constraint.rb +19 -0
  17. data/lib/mocha/instance_method.rb +9 -0
  18. data/lib/mocha/logger.rb +15 -0
  19. data/lib/mocha/mock.rb +19 -14
  20. data/lib/mocha/mockery.rb +166 -0
  21. data/lib/mocha/module_method.rb +17 -0
  22. data/lib/mocha/names.rb +53 -0
  23. data/lib/mocha/object.rb +26 -9
  24. data/lib/mocha/parameter_matchers.rb +2 -1
  25. data/lib/mocha/parameter_matchers/all_of.rb +3 -3
  26. data/lib/mocha/parameter_matchers/any_of.rb +3 -3
  27. data/lib/mocha/parameter_matchers/anything.rb +1 -1
  28. data/lib/mocha/parameter_matchers/has_entries.rb +4 -1
  29. data/lib/mocha/parameter_matchers/has_entry.rb +3 -2
  30. data/lib/mocha/parameter_matchers/has_key.rb +1 -1
  31. data/lib/mocha/parameter_matchers/has_value.rb +1 -1
  32. data/lib/mocha/parameter_matchers/not.rb +2 -2
  33. data/lib/mocha/parameter_matchers/object.rb +1 -1
  34. data/lib/mocha/parameter_matchers/optionally.rb +22 -0
  35. data/lib/mocha/parameter_matchers/regexp_matches.rb +2 -2
  36. data/lib/mocha/parameter_matchers/responds_with.rb +43 -0
  37. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +43 -0
  38. data/lib/mocha/single_return_value.rb +2 -9
  39. data/lib/mocha/standalone.rb +151 -17
  40. data/lib/mocha/state_machine.rb +91 -0
  41. data/lib/mocha/stubbing_error.rb +16 -0
  42. data/lib/mocha/test_case_adapter.rb +76 -22
  43. data/lib/stubba.rb +2 -1
  44. data/test/acceptance/acceptance_test_helper.rb +38 -0
  45. data/test/acceptance/bug_18914_test.rb +43 -0
  46. data/test/acceptance/{expected_invocation_count_acceptance_test.rb → expected_invocation_count_test.rb} +29 -20
  47. data/test/acceptance/failure_messages_test.rb +64 -0
  48. data/test/acceptance/{mocha_acceptance_test.rb → mocha_example_test.rb} +5 -5
  49. data/test/{integration/mocha_test_result_integration_test.rb → acceptance/mocha_test_result_test.rb} +19 -40
  50. data/test/acceptance/mock_test.rb +100 -0
  51. data/test/acceptance/{mock_with_initializer_block_acceptance_test.rb → mock_with_initializer_block_test.rb} +12 -5
  52. data/test/acceptance/{mocked_methods_dispatch_acceptance_test.rb → mocked_methods_dispatch_test.rb} +12 -5
  53. data/test/acceptance/{optional_parameters_acceptance_test.rb → optional_parameters_test.rb} +11 -4
  54. data/test/acceptance/{parameter_matcher_acceptance_test.rb → parameter_matcher_test.rb} +67 -5
  55. data/test/acceptance/{partial_mocks_acceptance_test.rb → partial_mocks_test.rb} +12 -5
  56. data/test/acceptance/return_value_test.rb +52 -0
  57. data/test/acceptance/{sequence_acceptance_test.rb → sequence_test.rb} +13 -6
  58. data/test/acceptance/{standalone_acceptance_test.rb → standalone_test.rb} +19 -11
  59. data/test/acceptance/states_test.rb +70 -0
  60. data/test/acceptance/stub_any_instance_method_test.rb +195 -0
  61. data/test/acceptance/stub_class_method_test.rb +203 -0
  62. data/test/acceptance/stub_everything_test.rb +56 -0
  63. data/test/acceptance/stub_instance_method_test.rb +165 -0
  64. data/test/acceptance/stub_module_method_test.rb +163 -0
  65. data/test/acceptance/stub_test.rb +52 -0
  66. data/test/acceptance/{stubba_acceptance_test.rb → stubba_example_test.rb} +1 -1
  67. data/test/{integration/stubba_test_result_integration_test.rb → acceptance/stubba_test_result_test.rb} +17 -36
  68. data/test/acceptance/stubbing_error_backtrace_test.rb +64 -0
  69. data/test/acceptance/stubbing_method_unnecessarily_test.rb +65 -0
  70. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +130 -0
  71. data/test/acceptance/stubbing_non_existent_class_method_test.rb +155 -0
  72. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +145 -0
  73. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +130 -0
  74. data/test/acceptance/stubbing_non_public_class_method_test.rb +161 -0
  75. data/test/acceptance/stubbing_non_public_instance_method_test.rb +141 -0
  76. data/test/acceptance/stubbing_on_non_mock_object_test.rb +64 -0
  77. data/test/execution_point.rb +3 -1
  78. data/test/simple_counter.rb +13 -0
  79. data/test/test_helper.rb +0 -1
  80. data/test/test_runner.rb +6 -4
  81. data/test/unit/any_instance_method_test.rb +1 -1
  82. data/test/unit/array_inspect_test.rb +1 -1
  83. data/test/unit/backtrace_filter_test.rb +19 -0
  84. data/test/unit/cardinality_test.rb +56 -0
  85. data/test/unit/central_test.rb +4 -63
  86. data/test/unit/change_state_side_effect_test.rb +41 -0
  87. data/test/unit/class_method_test.rb +38 -1
  88. data/test/unit/date_time_inspect_test.rb +1 -1
  89. data/test/unit/{expectation_raiser_test.rb → exception_raiser_test.rb} +14 -0
  90. data/test/unit/expectation_list_test.rb +4 -22
  91. data/test/unit/expectation_test.rb +70 -94
  92. data/test/unit/in_state_ordering_constraint_test.rb +43 -0
  93. data/test/unit/mock_test.rb +16 -37
  94. data/test/unit/mockery_test.rb +149 -0
  95. data/test/unit/{no_yield_test.rb → no_yields_test.rb} +0 -0
  96. data/test/unit/object_test.rb +6 -89
  97. data/test/unit/parameter_matchers/equals_test.rb +25 -0
  98. data/test/unit/parameter_matchers/has_entries_test.rb +22 -1
  99. data/test/unit/parameter_matchers/has_entry_test.rb +24 -2
  100. data/test/unit/parameter_matchers/has_key_test.rb +11 -0
  101. data/test/unit/parameter_matchers/has_value_test.rb +12 -0
  102. data/test/unit/parameter_matchers/regexp_matches_test.rb +1 -1
  103. data/test/unit/parameter_matchers/responds_with_test.rb +25 -0
  104. data/test/unit/parameter_matchers/stub_matcher.rb +4 -0
  105. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +25 -0
  106. data/test/unit/single_return_value_test.rb +0 -19
  107. data/test/unit/state_machine_test.rb +98 -0
  108. metadata +108 -69
  109. data/lib/mocha/auto_verify.rb +0 -118
  110. data/lib/mocha/infinite_range.rb +0 -25
  111. data/lib/mocha/missing_expectation.rb +0 -17
  112. data/lib/mocha/setup_and_teardown.rb +0 -23
  113. data/lib/mocha/stub.rb +0 -18
  114. data/test/integration/stubba_integration_test.rb +0 -89
  115. data/test/unit/auto_verify_test.rb +0 -129
  116. data/test/unit/expectation_error_test.rb +0 -24
  117. data/test/unit/infinite_range_test.rb +0 -53
  118. data/test/unit/missing_expectation_test.rb +0 -42
  119. data/test/unit/setup_and_teardown_test.rb +0 -76
  120. data/test/unit/stub_test.rb +0 -24
@@ -0,0 +1,100 @@
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
+ require 'mocha'
3
+
4
+ class MockTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
15
+
16
+ def test_should_build_mock_and_explicitly_add_an_expectation_which_is_satisfied
17
+ test_result = run_test do
18
+ foo = mock()
19
+ foo.expects(:bar)
20
+ foo.bar
21
+ end
22
+ assert_passed(test_result)
23
+ end
24
+
25
+ def test_should_build_mock_and_explicitly_add_an_expectation_which_is_not_satisfied
26
+ test_result = run_test do
27
+ foo = mock()
28
+ foo.expects(:bar)
29
+ end
30
+ assert_failed(test_result)
31
+ end
32
+
33
+ def test_should_build_named_mock_and_explicitly_add_an_expectation_which_is_satisfied
34
+ test_result = run_test do
35
+ foo = mock('foo')
36
+ foo.expects(:bar)
37
+ foo.bar
38
+ end
39
+ assert_passed(test_result)
40
+ end
41
+
42
+ def test_should_build_named_mock_and_explicitly_add_an_expectation_which_is_not_satisfied
43
+ test_result = run_test do
44
+ foo = mock('foo')
45
+ foo.expects(:bar)
46
+ end
47
+ assert_failed(test_result)
48
+ end
49
+
50
+ def test_should_build_mock_incorporating_two_expectations_which_are_satisifed
51
+ test_result = run_test do
52
+ foo = mock(:bar => 'bar', :baz => 'baz')
53
+ foo.bar
54
+ foo.baz
55
+ end
56
+ assert_passed(test_result)
57
+ end
58
+
59
+ def test_should_build_mock_incorporating_two_expectations_the_first_of_which_is_not_satisifed
60
+ test_result = run_test do
61
+ foo = mock(:bar => 'bar', :baz => 'baz')
62
+ foo.baz
63
+ end
64
+ assert_failed(test_result)
65
+ end
66
+
67
+ def test_should_build_mock_incorporating_two_expectations_the_second_of_which_is_not_satisifed
68
+ test_result = run_test do
69
+ foo = mock(:bar => 'bar', :baz => 'baz')
70
+ foo.bar
71
+ end
72
+ assert_failed(test_result)
73
+ end
74
+
75
+ def test_should_build_named_mock_incorporating_two_expectations_which_are_satisifed
76
+ test_result = run_test do
77
+ foo = mock('foo', :bar => 'bar', :baz => 'baz')
78
+ foo.bar
79
+ foo.baz
80
+ end
81
+ assert_passed(test_result)
82
+ end
83
+
84
+ def test_should_build_named_mock_incorporating_two_expectations_the_first_of_which_is_not_satisifed
85
+ test_result = run_test do
86
+ foo = mock('foo', :bar => 'bar', :baz => 'baz')
87
+ foo.baz
88
+ end
89
+ assert_failed(test_result)
90
+ end
91
+
92
+ def test_should_build_named_mock_incorporating_two_expectations_the_second_of_which_is_not_satisifed
93
+ test_result = run_test do
94
+ foo = mock('foo', :bar => 'bar', :baz => 'baz')
95
+ foo.bar
96
+ end
97
+ assert_failed(test_result)
98
+ end
99
+
100
+ end
@@ -1,11 +1,18 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class MockWithInitializerBlockAcceptanceTest < Test::Unit::TestCase
4
+ class MockWithInitializerBlockTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
6
15
 
7
- include TestRunner
8
-
9
16
  def test_should_expect_two_method_invocations_and_receive_both_of_them
10
17
  test_result = run_test do
11
18
  mock = mock() do
@@ -1,11 +1,18 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class MockedMethodDispatchAcceptanceTest < Test::Unit::TestCase
6
-
7
- include TestRunner
4
+ class MockedMethodDispatchTest < Test::Unit::TestCase
8
5
 
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
15
+
9
16
  def test_should_find_latest_matching_expectation
10
17
  test_result = run_test do
11
18
  mock = mock()
@@ -1,10 +1,17 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class OptionalParameterMatcherAcceptanceTest < Test::Unit::TestCase
4
+ class OptionalParameterMatcherTest < Test::Unit::TestCase
6
5
 
7
- include TestRunner
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
8
15
 
9
16
  def test_should_pass_if_all_required_parameters_match_and_no_optional_parameters_are_supplied
10
17
  test_result = run_test do
@@ -1,11 +1,18 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class ParameterMatcherAcceptanceTest < Test::Unit::TestCase
4
+ class ParameterMatcherTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
6
15
 
7
- include TestRunner
8
-
9
16
  def test_should_match_hash_parameter_with_specified_key
10
17
  test_result = run_test do
11
18
  mock = mock()
@@ -114,4 +121,59 @@ class ParameterMatcherAcceptanceTest < Test::Unit::TestCase
114
121
  assert_failed(test_result)
115
122
  end
116
123
 
124
+ def test_should_match_hash_parameter_with_specified_entries_using_nested_matchers
125
+ test_result = run_test do
126
+ mock = mock()
127
+ mock.expects(:method).with(has_entries(:key_1 => regexp_matches(/value_1/), kind_of(Symbol) => 'value_2'))
128
+ mock.method(:key_1 => 'value_1', :key_2 => 'value_2', :key_3 => 'value_3')
129
+ end
130
+ assert_passed(test_result)
131
+ end
132
+
133
+ def test_should_not_match_hash_parameter_with_specified_entries_using_nested_matchers
134
+ test_result = run_test do
135
+ mock = mock()
136
+ mock.expects(:method).with(has_entries(:key_1 => regexp_matches(/value_1/), kind_of(String) => 'value_2'))
137
+ mock.method(:key_1 => 'value_2', :key_2 => 'value_3')
138
+ end
139
+ assert_failed(test_result)
140
+ end
141
+
142
+ def test_should_match_parameter_that_matches_any_value
143
+ test_result = run_test do
144
+ mock = mock()
145
+ mock.expects(:method).with(any_of('value_1', 'value_2')).times(2)
146
+ mock.method('value_1')
147
+ mock.method('value_2')
148
+ end
149
+ assert_passed(test_result)
150
+ end
151
+
152
+ def test_should_not_match_parameter_that_does_not_match_any_value
153
+ test_result = run_test do
154
+ mock = mock()
155
+ mock.expects(:method).with(any_of('value_1', 'value_2'))
156
+ mock.method('value_3')
157
+ end
158
+ assert_failed(test_result)
159
+ end
160
+
161
+ def test_should_match_parameter_that_matches_all_values
162
+ test_result = run_test do
163
+ mock = mock()
164
+ mock.expects(:method).with(all_of('value_1', 'value_1'))
165
+ mock.method('value_1')
166
+ end
167
+ assert_passed(test_result)
168
+ end
169
+
170
+ def test_should_not_match_parameter_that_does_not_match_all_values
171
+ test_result = run_test do
172
+ mock = mock()
173
+ mock.expects(:method).with(all_of('value_1', 'value_2'))
174
+ mock.method('value_1')
175
+ end
176
+ assert_failed(test_result)
177
+ end
178
+
117
179
  end
@@ -1,11 +1,18 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class PartialMockAcceptanceTest < Test::Unit::TestCase
4
+ class PartialMockTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
6
15
 
7
- include TestRunner
8
-
9
16
  def test_should_pass_if_all_expectations_are_satisfied
10
17
  test_result = run_test do
11
18
  partial_mock_one = "partial_mock_one"
@@ -0,0 +1,52 @@
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
+ require 'mocha'
3
+
4
+ class ReturnValueTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
15
+
16
+ def test_should_build_mock_and_explicitly_add_an_expectation_with_a_return_value
17
+ test_result = run_test do
18
+ foo = mock('foo')
19
+ foo.expects(:bar).returns('bar')
20
+ assert_equal 'bar', foo.bar
21
+ end
22
+ assert_passed(test_result)
23
+ end
24
+
25
+ def test_should_build_mock_incorporating_two_expectations_with_return_values
26
+ test_result = run_test do
27
+ foo = mock('foo', :bar => 'bar', :baz => 'baz')
28
+ assert_equal 'bar', foo.bar
29
+ assert_equal 'baz', foo.baz
30
+ end
31
+ assert_passed(test_result)
32
+ end
33
+
34
+ def test_should_build_stub_and_explicitly_add_an_expectation_with_a_return_value
35
+ test_result = run_test do
36
+ foo = stub('foo')
37
+ foo.stubs(:bar).returns('bar')
38
+ assert_equal 'bar', foo.bar
39
+ end
40
+ assert_passed(test_result)
41
+ end
42
+
43
+ def test_should_build_stub_incorporating_two_expectations_with_return_values
44
+ test_result = run_test do
45
+ foo = stub('foo', :bar => 'bar', :baz => 'baz')
46
+ assert_equal 'bar', foo.bar
47
+ assert_equal 'baz', foo.baz
48
+ end
49
+ assert_passed(test_result)
50
+ end
51
+
52
+ end
@@ -1,11 +1,18 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha'
3
- require 'test_runner'
4
3
 
5
- class SequenceAcceptanceTest < Test::Unit::TestCase
4
+ class SequenceTest < Test::Unit::TestCase
5
+
6
+ include AcceptanceTest
7
+
8
+ def setup
9
+ setup_acceptance_test
10
+ end
11
+
12
+ def teardown
13
+ teardown_acceptance_test
14
+ end
6
15
 
7
- include TestRunner
8
-
9
16
  def test_should_constrain_invocations_to_occur_in_expected_order
10
17
  test_result = run_test do
11
18
  mock = mock()
@@ -97,7 +104,7 @@ class SequenceAcceptanceTest < Test::Unit::TestCase
97
104
  sequence = sequence('one')
98
105
 
99
106
  mock.expects(:first).in_sequence(sequence)
100
- s = mock.stubs(:second).in_sequence(sequence)
107
+ mock.stubs(:second).in_sequence(sequence)
101
108
  mock.expects(:third).in_sequence(sequence)
102
109
 
103
110
  mock.first
@@ -1,5 +1,6 @@
1
- require File.join(File.dirname(__FILE__), "..", "test_helper")
1
+ require File.join(File.dirname(__FILE__), "acceptance_test_helper")
2
2
  require 'mocha_standalone'
3
+ require 'simple_counter'
3
4
 
4
5
  class NotATestUnitAssertionFailedError < StandardError
5
6
  end
@@ -8,10 +9,10 @@ class NotATestUnitTestCase
8
9
 
9
10
  include Mocha::Standalone
10
11
 
11
- attr_reader :assertion_count
12
+ attr_reader :assertion_counter
12
13
 
13
14
  def initialize
14
- @assertion_count = 0
15
+ @assertion_counter = SimpleCounter.new
15
16
  end
16
17
 
17
18
  def run(test_method)
@@ -20,7 +21,7 @@ class NotATestUnitTestCase
20
21
  prepare
21
22
  begin
22
23
  send(test_method)
23
- mocha_verify { @assertion_count += 1 }
24
+ mocha_verify(@assertion_counter)
24
25
  rescue Mocha::ExpectationError => e
25
26
  new_error = NotATestUnitAssertionFailedError.new(e.message)
26
27
  new_error.set_backtrace(e.backtrace)
@@ -86,42 +87,49 @@ end
86
87
 
87
88
  require 'test/unit'
88
89
 
89
- class StandaloneAcceptanceTest < Test::Unit::TestCase
90
+ class StandaloneTest < Test::Unit::TestCase
90
91
 
91
92
  attr_reader :sample_test
92
93
 
94
+ include AcceptanceTest
95
+
93
96
  def setup
94
97
  @sample_test = SampleTest.new
98
+ setup_acceptance_test
99
+ end
100
+
101
+ def teardown
102
+ teardown_acceptance_test
95
103
  end
96
104
 
97
105
  def test_should_pass_mocha_test
98
106
  assert_nothing_raised { sample_test.run(:mocha_with_fulfilled_expectation) }
99
- assert_equal 1, sample_test.assertion_count
107
+ assert_equal 1, sample_test.assertion_counter.count
100
108
  end
101
109
 
102
110
  def test_should_fail_mocha_test_due_to_unfulfilled_exception
103
111
  assert_raises(NotATestUnitAssertionFailedError) { sample_test.run(:mocha_with_unfulfilled_expectation) }
104
- assert_equal 1, sample_test.assertion_count
112
+ assert_equal 1, sample_test.assertion_counter.count
105
113
  end
106
114
 
107
115
  def test_should_fail_mocha_test_due_to_unexpected_invocation
108
116
  assert_raises(NotATestUnitAssertionFailedError) { sample_test.run(:mocha_with_unexpected_invocation) }
109
- assert_equal 0, sample_test.assertion_count
117
+ assert_equal 0, sample_test.assertion_counter.count
110
118
  end
111
119
 
112
120
  def test_should_pass_stubba_test
113
121
  assert_nothing_raised { sample_test.run(:stubba_with_fulfilled_expectation) }
114
- assert_equal 1, sample_test.assertion_count
122
+ assert_equal 1, sample_test.assertion_counter.count
115
123
  end
116
124
 
117
125
  def test_should_fail_stubba_test
118
126
  assert_raises(NotATestUnitAssertionFailedError) { sample_test.run(:stubba_with_unfulfilled_expectation) }
119
- assert_equal 1, sample_test.assertion_count
127
+ assert_equal 1, sample_test.assertion_counter.count
120
128
  end
121
129
 
122
130
  def test_should_pass_mocha_test_with_matching_parameter
123
131
  assert_nothing_raised { sample_test.run(:mocha_with_matching_parameter) }
124
- assert_equal 1, sample_test.assertion_count
132
+ assert_equal 1, sample_test.assertion_counter.count
125
133
  end
126
134
 
127
135
  def test_should_fail_mocha_test_with_non_matching_parameter