mocha 0.10.5 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/COPYING.rdoc +1 -1
  2. data/README.rdoc +6 -4
  3. data/RELEASE.rdoc +12 -0
  4. data/Rakefile +29 -60
  5. data/doc/Mocha.html +112 -0
  6. data/doc/Mocha/API.html +898 -0
  7. data/doc/Mocha/ClassMethods.html +246 -0
  8. data/doc/Mocha/Configuration.html +471 -0
  9. data/doc/Mocha/Expectation.html +2570 -0
  10. data/doc/Mocha/Mock.html +830 -0
  11. data/doc/Mocha/ObjectMethods.html +668 -0
  12. data/doc/Mocha/ParameterMatchers.html +2715 -0
  13. data/doc/Mocha/ParameterMatchers/AllOf.html +137 -0
  14. data/doc/Mocha/ParameterMatchers/AnyOf.html +137 -0
  15. data/doc/Mocha/ParameterMatchers/AnyParameters.html +136 -0
  16. data/doc/Mocha/ParameterMatchers/Anything.html +136 -0
  17. data/doc/Mocha/ParameterMatchers/Base.html +419 -0
  18. data/doc/Mocha/ParameterMatchers/Equals.html +137 -0
  19. data/doc/Mocha/ParameterMatchers/HasEntries.html +137 -0
  20. data/doc/Mocha/ParameterMatchers/HasEntry.html +137 -0
  21. data/doc/Mocha/ParameterMatchers/HasKey.html +137 -0
  22. data/doc/Mocha/ParameterMatchers/HasValue.html +137 -0
  23. data/doc/Mocha/ParameterMatchers/Includes.html +137 -0
  24. data/doc/Mocha/ParameterMatchers/InstanceOf.html +137 -0
  25. data/doc/Mocha/ParameterMatchers/IsA.html +136 -0
  26. data/doc/Mocha/ParameterMatchers/KindOf.html +137 -0
  27. data/doc/Mocha/ParameterMatchers/Not.html +137 -0
  28. data/doc/Mocha/ParameterMatchers/Optionally.html +136 -0
  29. data/doc/Mocha/ParameterMatchers/QueryStringMatches.html +136 -0
  30. data/doc/Mocha/ParameterMatchers/RegexpMatches.html +137 -0
  31. data/doc/Mocha/ParameterMatchers/RespondsWith.html +137 -0
  32. data/doc/Mocha/ParameterMatchers/YamlEquivalent.html +137 -0
  33. data/doc/Mocha/Sequence.html +133 -0
  34. data/doc/Mocha/StateMachine.html +510 -0
  35. data/doc/Mocha/StateMachine/State.html +125 -0
  36. data/doc/Mocha/StateMachine/StatePredicate.html +125 -0
  37. data/doc/Mocha/StubbingError.html +134 -0
  38. data/doc/Mocha/UnexpectedInvocation.html +124 -0
  39. data/doc/_index.html +481 -0
  40. data/doc/class_list.html +47 -0
  41. data/doc/css/common.css +1 -0
  42. data/doc/css/full_list.css +55 -0
  43. data/doc/css/style.css +322 -0
  44. data/doc/file.COPYING.html +72 -0
  45. data/doc/file.MIT-LICENSE.html +86 -0
  46. data/doc/file.README.html +153 -0
  47. data/doc/file.RELEASE.html +933 -0
  48. data/doc/file.misc.html +108 -0
  49. data/doc/file.mocha.html +90 -0
  50. data/doc/file.stubba.html +129 -0
  51. data/doc/file_list.html +67 -0
  52. data/doc/frames.html +13 -0
  53. data/doc/index.html +153 -0
  54. data/doc/js/app.js +205 -0
  55. data/doc/js/full_list.js +173 -0
  56. data/doc/js/jquery.js +16 -0
  57. data/doc/method_list.html +510 -0
  58. data/doc/top-level-namespace.html +105 -0
  59. data/lib/mocha/any_instance_method.rb +16 -11
  60. data/lib/mocha/api.rb +120 -106
  61. data/lib/mocha/argument_iterator.rb +6 -6
  62. data/lib/mocha/backtrace_filter.rb +1 -1
  63. data/lib/mocha/cardinality.rb +21 -21
  64. data/lib/mocha/central.rb +8 -8
  65. data/lib/mocha/change_state_side_effect.rb +5 -5
  66. data/lib/mocha/class_method.rb +14 -19
  67. data/lib/mocha/configuration.rb +47 -37
  68. data/lib/mocha/deprecation.rb +8 -8
  69. data/lib/mocha/exception_raiser.rb +7 -7
  70. data/lib/mocha/expectation.rb +173 -77
  71. data/lib/mocha/expectation_error.rb +2 -2
  72. data/lib/mocha/expectation_list.rb +11 -11
  73. data/lib/mocha/in_state_ordering_constraint.rb +5 -5
  74. data/lib/mocha/inspect.rb +8 -8
  75. data/lib/mocha/instance_method.rb +1 -17
  76. data/lib/mocha/integration.rb +9 -9
  77. data/lib/mocha/integration/mini_test/assertion_counter.rb +9 -9
  78. data/lib/mocha/integration/mini_test/exception_translation.rb +6 -6
  79. data/lib/mocha/integration/mini_test/version_13.rb +6 -6
  80. data/lib/mocha/integration/mini_test/version_140.rb +6 -6
  81. data/lib/mocha/integration/mini_test/version_141.rb +6 -6
  82. data/lib/mocha/integration/mini_test/version_142_to_172.rb +7 -7
  83. data/lib/mocha/integration/mini_test/version_200.rb +7 -7
  84. data/lib/mocha/integration/test_unit/assertion_counter.rb +10 -10
  85. data/lib/mocha/integration/test_unit/gem_version_200.rb +6 -6
  86. data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +6 -6
  87. data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +6 -6
  88. data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +6 -6
  89. data/lib/mocha/is_a.rb +1 -1
  90. data/lib/mocha/logger.rb +6 -6
  91. data/lib/mocha/method_matcher.rb +7 -7
  92. data/lib/mocha/mock.rb +85 -48
  93. data/lib/mocha/mockery.rb +47 -33
  94. data/lib/mocha/module_method.rb +2 -2
  95. data/lib/mocha/multiple_yields.rb +9 -9
  96. data/lib/mocha/names.rb +18 -18
  97. data/lib/mocha/no_yields.rb +7 -7
  98. data/lib/mocha/object.rb +104 -75
  99. data/lib/mocha/parameter_matchers.rb +3 -3
  100. data/lib/mocha/parameter_matchers/all_of.rb +22 -12
  101. data/lib/mocha/parameter_matchers/any_of.rb +23 -12
  102. data/lib/mocha/parameter_matchers/any_parameters.rb +15 -8
  103. data/lib/mocha/parameter_matchers/anything.rb +20 -11
  104. data/lib/mocha/parameter_matchers/base.rb +35 -27
  105. data/lib/mocha/parameter_matchers/equals.rb +23 -12
  106. data/lib/mocha/parameter_matchers/has_entries.rb +22 -12
  107. data/lib/mocha/parameter_matchers/has_entry.rb +31 -13
  108. data/lib/mocha/parameter_matchers/has_key.rb +21 -11
  109. data/lib/mocha/parameter_matchers/has_value.rb +21 -11
  110. data/lib/mocha/parameter_matchers/includes.rb +15 -5
  111. data/lib/mocha/parameter_matchers/instance_of.rb +23 -12
  112. data/lib/mocha/parameter_matchers/is_a.rb +23 -12
  113. data/lib/mocha/parameter_matchers/kind_of.rb +23 -12
  114. data/lib/mocha/parameter_matchers/not.rb +22 -12
  115. data/lib/mocha/parameter_matchers/object.rb +5 -3
  116. data/lib/mocha/parameter_matchers/optionally.rb +24 -12
  117. data/lib/mocha/parameter_matchers/query_string.rb +14 -3
  118. data/lib/mocha/parameter_matchers/regexp_matches.rb +21 -11
  119. data/lib/mocha/parameter_matchers/responds_with.rb +17 -6
  120. data/lib/mocha/parameter_matchers/yaml_equivalent.rb +16 -6
  121. data/lib/mocha/parameters_matcher.rb +8 -8
  122. data/lib/mocha/pretty_parameters.rb +7 -7
  123. data/lib/mocha/return_values.rb +11 -11
  124. data/lib/mocha/sequence.rb +23 -14
  125. data/lib/mocha/single_return_value.rb +7 -7
  126. data/lib/mocha/single_yield.rb +9 -9
  127. data/lib/mocha/standalone.rb +1 -1
  128. data/lib/mocha/state_machine.rb +61 -46
  129. data/lib/mocha/stubbing_error.rb +8 -5
  130. data/lib/mocha/thrower.rb +2 -2
  131. data/lib/mocha/unexpected_invocation.rb +9 -6
  132. data/lib/mocha/version.rb +1 -1
  133. data/lib/mocha/yield_parameters.rb +10 -10
  134. data/lib/mocha_standalone.rb +1 -1
  135. data/mocha.gemspec +4 -7
  136. data/test/acceptance/acceptance_test_helper.rb +10 -10
  137. data/test/acceptance/api_test.rb +20 -20
  138. data/test/acceptance/bug_18914_test.rb +12 -12
  139. data/test/acceptance/bug_21465_test.rb +6 -6
  140. data/test/acceptance/bug_21563_test.rb +5 -5
  141. data/test/acceptance/exception_rescue_test.rb +1 -1
  142. data/test/acceptance/expected_invocation_count_test.rb +17 -17
  143. data/test/acceptance/failure_messages_test.rb +13 -13
  144. data/test/acceptance/minitest_test.rb +39 -39
  145. data/test/acceptance/mocha_example_test.rb +26 -26
  146. data/test/acceptance/mocha_test_result_test.rb +13 -13
  147. data/test/acceptance/mock_test.rb +5 -5
  148. data/test/acceptance/mock_with_initializer_block_test.rb +5 -5
  149. data/test/acceptance/mocked_methods_dispatch_test.rb +4 -4
  150. data/test/acceptance/multiple_expectations_failure_message_test.rb +2 -2
  151. data/test/acceptance/optional_parameters_test.rb +5 -5
  152. data/test/acceptance/parameter_matcher_test.rb +18 -18
  153. data/test/acceptance/partial_mocks_test.rb +9 -9
  154. data/test/acceptance/raise_exception_test.rb +1 -1
  155. data/test/acceptance/return_value_test.rb +5 -5
  156. data/test/acceptance/sequence_test.rb +29 -29
  157. data/test/acceptance/states_test.rb +17 -17
  158. data/test/acceptance/stub_any_instance_method_test.rb +13 -13
  159. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +7 -7
  160. data/test/acceptance/stub_everything_test.rb +5 -5
  161. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +1 -1
  162. data/test/acceptance/stub_module_method_test.rb +17 -17
  163. data/test/acceptance/stub_test.rb +5 -5
  164. data/test/acceptance/stubba_example_test.rb +24 -24
  165. data/test/acceptance/stubba_test_result_test.rb +11 -11
  166. data/test/acceptance/stubbing_error_backtrace_test.rb +6 -6
  167. data/test/acceptance/stubbing_frozen_object_test.rb +88 -0
  168. data/test/acceptance/stubbing_method_unnecessarily_test.rb +9 -9
  169. data/test/acceptance/stubbing_nil_test.rb +59 -0
  170. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +13 -13
  171. data/test/acceptance/stubbing_non_existent_class_method_test.rb +15 -15
  172. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +14 -14
  173. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +13 -13
  174. data/test/acceptance/stubbing_non_public_class_method_test.rb +12 -12
  175. data/test/acceptance/stubbing_non_public_instance_method_test.rb +12 -12
  176. data/test/acceptance/stubbing_on_non_mock_object_test.rb +9 -9
  177. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +35 -0
  178. data/test/acceptance/throw_test.rb +1 -1
  179. data/test/deprecation_disabler.rb +1 -1
  180. data/test/execution_point.rb +7 -7
  181. data/test/method_definer.rb +1 -1
  182. data/test/mini_test_result.rb +21 -21
  183. data/test/simple_counter.rb +5 -5
  184. data/test/test_helper.rb +1 -1
  185. data/test/test_runner.rb +22 -24
  186. data/test/test_unit_result.rb +20 -0
  187. data/test/unit/any_instance_method_test.rb +28 -32
  188. data/test/unit/array_inspect_test.rb +3 -3
  189. data/test/unit/backtrace_filter_test.rb +3 -3
  190. data/test/unit/cardinality_test.rb +12 -12
  191. data/test/unit/central_test.rb +18 -18
  192. data/test/unit/change_state_side_effect_test.rb +12 -12
  193. data/test/unit/class_method_test.rb +33 -91
  194. data/test/unit/date_time_inspect_test.rb +4 -4
  195. data/test/unit/exception_raiser_test.rb +5 -5
  196. data/test/unit/expectation_list_test.rb +7 -7
  197. data/test/unit/expectation_test.rb +66 -66
  198. data/test/unit/hash_inspect_test.rb +4 -4
  199. data/test/unit/in_state_ordering_constraint_test.rb +13 -13
  200. data/test/unit/method_matcher_test.rb +3 -3
  201. data/test/unit/mock_test.rb +40 -40
  202. data/test/unit/mockery_test.rb +25 -25
  203. data/test/unit/multiple_yields_test.rb +2 -2
  204. data/test/unit/no_yields_test.rb +2 -2
  205. data/test/unit/object_inspect_test.rb +4 -4
  206. data/test/unit/object_test.rb +15 -15
  207. data/test/unit/parameter_matchers/all_of_test.rb +6 -6
  208. data/test/unit/parameter_matchers/any_of_test.rb +6 -6
  209. data/test/unit/parameter_matchers/anything_test.rb +5 -5
  210. data/test/unit/parameter_matchers/has_entries_test.rb +10 -10
  211. data/test/unit/parameter_matchers/has_entry_test.rb +13 -13
  212. data/test/unit/parameter_matchers/has_key_test.rb +11 -11
  213. data/test/unit/parameter_matchers/has_value_test.rb +12 -12
  214. data/test/unit/parameter_matchers/includes_test.rb +4 -4
  215. data/test/unit/parameter_matchers/not_test.rb +6 -6
  216. data/test/unit/parameter_matchers/regexp_matches_test.rb +9 -9
  217. data/test/unit/parameter_matchers/responds_with_test.rb +6 -6
  218. data/test/unit/parameter_matchers/stub_matcher.rb +4 -4
  219. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +6 -6
  220. data/test/unit/parameters_matcher_test.rb +16 -16
  221. data/test/unit/return_values_test.rb +5 -5
  222. data/test/unit/sequence_test.rb +10 -10
  223. data/test/unit/single_return_value_test.rb +3 -3
  224. data/test/unit/single_yield_test.rb +2 -2
  225. data/test/unit/state_machine_test.rb +19 -19
  226. data/test/unit/string_inspect_test.rb +2 -2
  227. data/test/unit/thrower_test.rb +1 -1
  228. data/test/unit/yield_parameters_test.rb +11 -11
  229. metadata +113 -101
@@ -0,0 +1,108 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: misc
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: misc</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'><pre class="code ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>'</span></span>
58
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mocha</span><span class='tstring_end'>'</span></span>
59
+
60
+ <span class='kw'>class</span> <span class='const'>MiscExampleTest</span> <span class='op'>&lt;</span> <span class='const'>Test</span><span class='op'>::</span><span class='const'>Unit</span><span class='op'>::</span><span class='const'>TestCase</span>
61
+
62
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_mocking_a_class_method'>test_mocking_a_class_method</span>
63
+ <span class='id identifier rubyid_product'>product</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
64
+ <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:find</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='id identifier rubyid_product'>product</span><span class='rparen'>)</span>
65
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='id identifier rubyid_product'>product</span><span class='comma'>,</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
66
+ <span class='kw'>end</span>
67
+
68
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_mocking_an_instance_method_on_a_real_object'>test_mocking_an_instance_method_on_a_real_object</span>
69
+ <span class='id identifier rubyid_product'>product</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
70
+ <span class='id identifier rubyid_product'>product</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:save</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</span>
71
+ <span class='id identifier rubyid_assert'>assert</span> <span class='id identifier rubyid_product'>product</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span>
72
+ <span class='kw'>end</span>
73
+
74
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_stubbing_instance_methods_on_real_objects'>test_stubbing_instance_methods_on_real_objects</span>
75
+ <span class='id identifier rubyid_prices'>prices</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='symbol'>:pence</span> <span class='op'>=&gt;</span> <span class='int'>1000</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='symbol'>:pence</span> <span class='op'>=&gt;</span> <span class='int'>2000</span><span class='rparen'>)</span><span class='rbracket'>]</span>
76
+ <span class='id identifier rubyid_product'>product</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
77
+ <span class='id identifier rubyid_product'>product</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:prices</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='id identifier rubyid_prices'>prices</span><span class='rparen'>)</span>
78
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='lbracket'>[</span><span class='int'>1000</span><span class='comma'>,</span> <span class='int'>2000</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_product'>product</span><span class='period'>.</span><span class='id identifier rubyid_prices'>prices</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_pence'>pence</span><span class='rbrace'>}</span>
79
+ <span class='kw'>end</span>
80
+
81
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_stubbing_an_instance_method_on_all_instances_of_a_class'>test_stubbing_an_instance_method_on_all_instances_of_a_class</span>
82
+ <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_any_instance'>any_instance</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stubbed_name</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
83
+ <span class='id identifier rubyid_product'>product</span> <span class='op'>=</span> <span class='const'>Product</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
84
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>stubbed_name</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_product'>product</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
85
+ <span class='kw'>end</span>
86
+
87
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_traditional_mocking'>test_traditional_mocking</span>
88
+ <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
89
+ <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='symbol'>:p1</span><span class='comma'>,</span> <span class='symbol'>:p2</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span>
90
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='symbol'>:result</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span><span class='lparen'>(</span><span class='symbol'>:p1</span><span class='comma'>,</span> <span class='symbol'>:p2</span><span class='rparen'>)</span>
91
+ <span class='kw'>end</span>
92
+
93
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_shortcuts'>test_shortcuts</span>
94
+ <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='symbol'>:method1</span> <span class='op'>=&gt;</span> <span class='symbol'>:result1</span><span class='comma'>,</span> <span class='symbol'>:method2</span> <span class='op'>=&gt;</span> <span class='symbol'>:result2</span><span class='rparen'>)</span>
95
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='symbol'>:result1</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method1'>method1</span>
96
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='symbol'>:result2</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_method2'>method2</span>
97
+ <span class='kw'>end</span>
98
+
99
+ <span class='kw'>end</span></pre></div></div>
100
+
101
+ <div id="footer">
102
+ Generated on Thu Apr 19 10:54:34 2012 by
103
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
104
+ 0.7.5 (ruby-1.9.3).
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,90 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: mocha
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: mocha</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'><pre class="code ruby"><span class='kw'>class</span> <span class='const'>Enterprise</span>
58
+
59
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_dilithium'>dilithium</span><span class='rparen'>)</span>
60
+ <span class='ivar'>@dilithium</span> <span class='op'>=</span> <span class='id identifier rubyid_dilithium'>dilithium</span>
61
+ <span class='kw'>end</span>
62
+
63
+ <span class='kw'>def</span> <span class='id identifier rubyid_go'>go</span><span class='lparen'>(</span><span class='id identifier rubyid_warp_factor'>warp_factor</span><span class='rparen'>)</span>
64
+ <span class='id identifier rubyid_warp_factor'>warp_factor</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='lbrace'>{</span> <span class='ivar'>@dilithium</span><span class='period'>.</span><span class='id identifier rubyid_nuke'>nuke</span><span class='lparen'>(</span><span class='symbol'>:anti_matter</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
65
+ <span class='kw'>end</span>
66
+
67
+ <span class='kw'>end</span>
68
+
69
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>'</span></span>
70
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mocha</span><span class='tstring_end'>'</span></span>
71
+
72
+ <span class='kw'>class</span> <span class='const'>EnterpriseTest</span> <span class='op'>&lt;</span> <span class='const'>Test</span><span class='op'>::</span><span class='const'>Unit</span><span class='op'>::</span><span class='const'>TestCase</span>
73
+
74
+ <span class='kw'>def</span> <span class='id identifier rubyid_test_should_boldly_go'>test_should_boldly_go</span>
75
+ <span class='id identifier rubyid_dilithium'>dilithium</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
76
+ <span class='id identifier rubyid_dilithium'>dilithium</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:nuke</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='symbol'>:anti_matter</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_at_least_once'>at_least_once</span> <span class='comment'># auto-verified at end of test
77
+ </span> <span class='id identifier rubyid_enterprise'>enterprise</span> <span class='op'>=</span> <span class='const'>Enterprise</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_dilithium'>dilithium</span><span class='rparen'>)</span>
78
+ <span class='id identifier rubyid_enterprise'>enterprise</span><span class='period'>.</span><span class='id identifier rubyid_go'>go</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
79
+ <span class='kw'>end</span>
80
+
81
+ <span class='kw'>end</span></pre></div></div>
82
+
83
+ <div id="footer">
84
+ Generated on Thu Apr 19 10:54:34 2012 by
85
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
86
+ 0.7.5 (ruby-1.9.3).
87
+ </div>
88
+
89
+ </body>
90
+ </html>
@@ -0,0 +1,129 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: stubba
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: stubba</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'><pre class="code ruby"><span class='kw'>class</span> <span class='const'>Order</span>
58
+
59
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:shipped_on</span>
60
+
61
+ <span class='kw'>def</span> <span class='id identifier rubyid_total_cost'>total_cost</span>
62
+ <span class='id identifier rubyid_line_items'>line_items</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_total'>total</span><span class='comma'>,</span> <span class='id identifier rubyid_line_item'>line_item</span><span class='op'>|</span> <span class='id identifier rubyid_total'>total</span> <span class='op'>+</span> <span class='id identifier rubyid_line_item'>line_item</span><span class='period'>.</span><span class='id identifier rubyid_price'>price</span> <span class='rbrace'>}</span> <span class='op'>+</span> <span class='id identifier rubyid_shipping_cost'>shipping_cost</span>
63
+ <span class='kw'>end</span>
64
+
65
+ <span class='kw'>def</span> <span class='id identifier rubyid_total_weight'>total_weight</span>
66
+ <span class='id identifier rubyid_line_items'>line_items</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_total'>total</span><span class='comma'>,</span> <span class='id identifier rubyid_line_item'>line_item</span><span class='op'>|</span> <span class='id identifier rubyid_total'>total</span> <span class='op'>+</span> <span class='id identifier rubyid_line_item'>line_item</span><span class='period'>.</span><span class='id identifier rubyid_weight'>weight</span> <span class='rbrace'>}</span>
67
+ <span class='kw'>end</span>
68
+
69
+ <span class='kw'>def</span> <span class='id identifier rubyid_shipping_cost'>shipping_cost</span>
70
+ <span class='id identifier rubyid_total_weight'>total_weight</span> <span class='op'>*</span> <span class='int'>5</span> <span class='op'>+</span> <span class='int'>10</span>
71
+ <span class='kw'>end</span>
72
+
73
+ <span class='kw'>class</span> <span class='op'>&lt;&lt;</span> <span class='kw'>self</span>
74
+
75
+ <span class='kw'>def</span> <span class='id identifier rubyid_find_all'>find_all</span>
76
+ <span class='comment'># Database.connection.execute('select * from orders...
77
+ </span> <span class='kw'>end</span>
78
+
79
+ <span class='kw'>def</span> <span class='id identifier rubyid_number_shipped_since'>number_shipped_since</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='rparen'>)</span>
80
+ <span class='id identifier rubyid_find_all'>find_all</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_order'>order</span><span class='op'>|</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_shipped_on'>shipped_on</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_date'>date</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
81
+ <span class='kw'>end</span>
82
+
83
+ <span class='kw'>def</span> <span class='id identifier rubyid_unshipped_value'>unshipped_value</span>
84
+ <span class='id identifier rubyid_find_all'>find_all</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_total'>total</span><span class='comma'>,</span> <span class='id identifier rubyid_order'>order</span><span class='op'>|</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_shipped_on'>shipped_on</span> <span class='op'>?</span> <span class='id identifier rubyid_total'>total</span> <span class='op'>:</span> <span class='id identifier rubyid_total'>total</span> <span class='op'>+</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_total_cost'>total_cost</span> <span class='rbrace'>}</span>
85
+ <span class='kw'>end</span>
86
+
87
+ <span class='kw'>end</span>
88
+
89
+ <span class='kw'>end</span>
90
+
91
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>'</span></span>
92
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mocha</span><span class='tstring_end'>'</span></span>
93
+
94
+ <span class='kw'>class</span> <span class='const'>OrderTest</span> <span class='op'>&lt;</span> <span class='const'>Test</span><span class='op'>::</span><span class='const'>Unit</span><span class='op'>::</span><span class='const'>TestCase</span>
95
+
96
+ <span class='comment'># illustrates stubbing instance method
97
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_test_should_calculate_shipping_cost_based_on_total_weight'>test_should_calculate_shipping_cost_based_on_total_weight</span>
98
+ <span class='id identifier rubyid_order'>order</span> <span class='op'>=</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
99
+ <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:total_weight</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
100
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='int'>60</span><span class='comma'>,</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_shipping_cost'>shipping_cost</span>
101
+ <span class='kw'>end</span>
102
+
103
+ <span class='comment'># illustrates stubbing class method
104
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_test_should_count_number_of_orders_shipped_after_specified_date'>test_should_count_number_of_orders_shipped_after_specified_date</span>
105
+ <span class='id identifier rubyid_now'>now</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='semicolon'>;</span> <span class='id identifier rubyid_week_in_secs'>week_in_secs</span> <span class='op'>=</span> <span class='int'>7</span> <span class='op'>*</span> <span class='int'>24</span> <span class='op'>*</span> <span class='int'>60</span> <span class='op'>*</span> <span class='int'>60</span>
106
+ <span class='id identifier rubyid_order_1'>order_1</span> <span class='op'>=</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='semicolon'>;</span> <span class='id identifier rubyid_order_1'>order_1</span><span class='period'>.</span><span class='id identifier rubyid_shipped_on'>shipped_on</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>1</span> <span class='op'>*</span> <span class='id identifier rubyid_week_in_secs'>week_in_secs</span>
107
+ <span class='id identifier rubyid_order_2'>order_2</span> <span class='op'>=</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='semicolon'>;</span> <span class='id identifier rubyid_order_2'>order_2</span><span class='period'>.</span><span class='id identifier rubyid_shipped_on'>shipped_on</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>3</span> <span class='op'>*</span> <span class='id identifier rubyid_week_in_secs'>week_in_secs</span>
108
+ <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:find_all</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_order_1'>order_1</span><span class='comma'>,</span> <span class='id identifier rubyid_order_2'>order_2</span><span class='rbracket'>]</span><span class='rparen'>)</span>
109
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='int'>1</span><span class='comma'>,</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_number_shipped_since'>number_shipped_since</span><span class='lparen'>(</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>2</span> <span class='op'>*</span> <span class='id identifier rubyid_week_in_secs'>week_in_secs</span><span class='rparen'>)</span>
110
+ <span class='kw'>end</span>
111
+
112
+ <span class='comment'># illustrates stubbing instance method for all instances of a class
113
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_test_should_calculate_value_of_unshipped_orders'>test_should_calculate_value_of_unshipped_orders</span>
114
+ <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:find_all</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='comma'>,</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rbracket'>]</span><span class='rparen'>)</span>
115
+ <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_any_instance'>any_instance</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:shipped_on</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
116
+ <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_any_instance'>any_instance</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:total_cost</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='int'>10</span><span class='rparen'>)</span>
117
+ <span class='id identifier rubyid_assert_equal'>assert_equal</span> <span class='int'>30</span><span class='comma'>,</span> <span class='const'>Order</span><span class='period'>.</span><span class='id identifier rubyid_unshipped_value'>unshipped_value</span>
118
+ <span class='kw'>end</span>
119
+
120
+ <span class='kw'>end</span></pre></div></div>
121
+
122
+ <div id="footer">
123
+ Generated on Thu Apr 19 10:54:34 2012 by
124
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
125
+ 0.7.5 (ruby-1.9.3).
126
+ </div>
127
+
128
+ </body>
129
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <base id="base_target" target="_parent" />
19
+ </head>
20
+ <body>
21
+ <script type="text/javascript" charset="utf-8">
22
+ if (window.top.frames.main) {
23
+ document.getElementById('base_target').target = 'main';
24
+ document.body.className = 'frames';
25
+ }
26
+ </script>
27
+ <div id="content">
28
+ <h1 id="full_list_header">File List</h1>
29
+ <div id="nav">
30
+
31
+ <a target="_self" href="class_list.html">Classes</a>
32
+
33
+ <a target="_self" href="method_list.html">Methods</a>
34
+
35
+ <a target="_self" href="file_list.html">Files</a>
36
+
37
+ </div>
38
+ <div id="search">Search: <input type="text" /></div>
39
+
40
+ <ul id="full_list" class="files">
41
+
42
+
43
+ <li class="r1"><a href="index.html" title="README">README</a></li>
44
+
45
+
46
+ <li class="r2"><a href="file.RELEASE.html" title="RELEASE">RELEASE</a></li>
47
+
48
+
49
+ <li class="r1"><a href="file.COPYING.html" title="COPYING">COPYING</a></li>
50
+
51
+
52
+ <li class="r2"><a href="file.MIT-LICENSE.html" title="MIT-LICENSE">MIT-LICENSE</a></li>
53
+
54
+
55
+ <li class="r1"><a href="file.mocha.html" title="mocha">mocha</a></li>
56
+
57
+
58
+ <li class="r2"><a href="file.stubba.html" title="stubba">stubba</a></li>
59
+
60
+
61
+ <li class="r1"><a href="file.misc.html" title="misc">misc</a></li>
62
+
63
+
64
+ </ul>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Mocha 0.11.0</title>
8
+ </head>
9
+ <frameset cols="20%,*">
10
+ <frame name="list" src="class_list.html" />
11
+ <frame name="main" src="index.html" />
12
+ </frameset>
13
+ </html>
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Mocha 0.11.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="_index.html" title="Index">Index</a> &raquo;
37
+ <span class="title">File: README</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a id="class_list_link" href="#">Class List</a>
46
+
47
+ <a id="method_list_link" href="#">Method List</a>
48
+
49
+ <a id="file_list_link" href="#">File List</a>
50
+
51
+ </div>
52
+ <div class="clear"></div>
53
+ </div>
54
+
55
+ <iframe id="search_frame"></iframe>
56
+
57
+ <div id="content"><div id='filecontents'>
58
+ <h1>Mocha <a href="http://travis-ci.org/floehopper/mocha"><img src="https://secure.travis-ci.org/floehopper/mocha.png" /></a></h1>
59
+
60
+ <p>Mocha is a library for mocking and stubbing using a syntax like that of <a
61
+ href="http://www.jmock.org">JMock</a>.</p>
62
+
63
+ <p>It can be used with many testing frameworks e.g. <a
64
+ href="http://www.ruby-doc.org/core/classes/Test/Unit.html">Test::Unit</a>,
65
+ <a href="http://rspec.info/">RSpec</a>, <a
66
+ href="http://chneukirchen.org/repos/testspec/README">test/spec</a>, <a
67
+ href="http://expectations.rubyforge.org/">expectations</a>, <a
68
+ href="http://dust.rubyforge.org/">Dust</a>, <a
69
+ href="http://rubyforge.org/projects/bfts">MiniTest</a> and even <a
70
+ href="http://jtestr.codehaus.org/">JtestR</a>.</p>
71
+
72
+ <p>Mocha provides a unified, simple and readable syntax for both traditional
73
+ mocking and partial mocking.</p>
74
+
75
+ <p>Mocha was harvested from projects at <a
76
+ href="http://www.reevoo.com/">Reevoo</a> by me (<a
77
+ href="http://jamesmead.org/">James</a>) and my (then) colleagues <a
78
+ href="http://www.techbelly.com/">Ben</a>, <a
79
+ href="http://chrisroos.co.uk/">Chris</a> and <a
80
+ href="http://po-ru.com/">Paul</a>.</p>
81
+
82
+ <h2>Installation</h2>
83
+
84
+ <p>Install the latest version of the gem with the following command…</p>
85
+
86
+ <pre class="code ruby"><code>$ gem install mocha</code></pre>
87
+
88
+ <p>Note that if you are intending to use Mocha with Test::Unit or MiniTest,
89
+ you should only load Mocha <b>after</b> loading the relevant test library…</p>
90
+
91
+ <pre class="code ruby"><code><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>&quot;</span></span>
92
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span></code></pre>
93
+
94
+ <p>If you’re using Bundler, ensure the correct load order by not
95
+ auto-requiring Mocha in the Gemfile and then later load it once you know
96
+ the test library has been loaded…</p>
97
+
98
+ <pre class="code ruby"><code><span class='comment'># Gemfile
99
+ </span><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:require</span> <span class='op'>=&gt;</span> <span class='kw'>false</span>
100
+
101
+ <span class='comment'># Elsewhere after Bundler has loaded gems
102
+ </span><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>test/unit</span><span class='tstring_end'>&quot;</span></span>
103
+ <span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mocha</span><span class='tstring_end'>&quot;</span></span></code></pre>
104
+
105
+ <p>Note that versions 0.10.2 &amp; 0.10.3 included a bug. Please do not use
106
+ these versions.</p>
107
+
108
+ <p>Or install the <a href="http://www.rubyonrails.org/">Rails</a> plugin…</p>
109
+
110
+ <pre class="code ruby"><code>$ script/plugin install git://github.com/floehopper/mocha.git</code></pre>
111
+
112
+ <p>Note that versions 0.9.6 &amp; 0.9.7 of the Rails plugin were broken. As of
113
+ version 0.9.8, you need to explicitly load Mocha after the test framework
114
+ e.g. by adding “require ‘mocha’” at the bottom of test/test_helper.rb.</p>
115
+
116
+ <h2>Examples</h2>
117
+ <ul><li>
118
+ <p>Quick Start - <a href="file.misc.html" title="Usage Examples">Usage Examples</a></p>
119
+ </li><li>
120
+ <p>Traditional mocking - <a href="file.mocha.html" title="Star Trek Example">Star Trek Example</a></p>
121
+ </li><li>
122
+ <p>Setting expectations on real classes - <a href="file.stubba.html" title="Order Example">Order Example</a></p>
123
+ </li><li>
124
+ <p>More examples on <a href="http://jamesmead.org/blog/">James Mead’s Blog</a></p>
125
+ </li><li>
126
+ <p><a href="http://groups.google.com/group/mocha-developer">Mailing List
127
+ Archives</a></p>
128
+ </li></ul>
129
+
130
+ <h2>Links</h2>
131
+ <ul><li>
132
+ <p><a href="http://github.com/floehopper/mocha">Source code</a></p>
133
+ </li><li>
134
+ <p><a href="http://github.com/floehopper/mocha/issues">Bug reports</a></p>
135
+ </li></ul>
136
+
137
+ <h2>License</h2>
138
+
139
+ <p>Copyright Revieworld Ltd. 2006</p>
140
+
141
+ <p>You may use, copy and redistribute this library under the same terms as <a
142
+ href="http://www.ruby-lang.org/en/LICENSE.txt">Ruby itself</a> or under the
143
+ <a href="file.MIT-LICENSE.html" title="MIT license">MIT license</a>.</p>
144
+ </div></div>
145
+
146
+ <div id="footer">
147
+ Generated on Thu Apr 19 10:54:33 2012 by
148
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
149
+ 0.7.5 (ruby-1.9.3).
150
+ </div>
151
+
152
+ </body>
153
+ </html>