mocha 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/README.rdoc +3 -3
  2. data/RELEASE.rdoc +3 -0
  3. data/Rakefile +1 -3
  4. data/lib/mocha/version.rb +1 -1
  5. data/mocha.gemspec +1 -1
  6. metadata +12 -67
  7. data/doc/.nojekyll +0 -0
  8. data/doc/Mocha.html +0 -112
  9. data/doc/Mocha/API.html +0 -898
  10. data/doc/Mocha/ClassMethods.html +0 -246
  11. data/doc/Mocha/Configuration.html +0 -471
  12. data/doc/Mocha/Expectation.html +0 -2570
  13. data/doc/Mocha/Mock.html +0 -830
  14. data/doc/Mocha/ObjectMethods.html +0 -668
  15. data/doc/Mocha/ParameterMatchers.html +0 -2715
  16. data/doc/Mocha/ParameterMatchers/AllOf.html +0 -137
  17. data/doc/Mocha/ParameterMatchers/AnyOf.html +0 -137
  18. data/doc/Mocha/ParameterMatchers/AnyParameters.html +0 -136
  19. data/doc/Mocha/ParameterMatchers/Anything.html +0 -136
  20. data/doc/Mocha/ParameterMatchers/Base.html +0 -419
  21. data/doc/Mocha/ParameterMatchers/Equals.html +0 -137
  22. data/doc/Mocha/ParameterMatchers/HasEntries.html +0 -137
  23. data/doc/Mocha/ParameterMatchers/HasEntry.html +0 -137
  24. data/doc/Mocha/ParameterMatchers/HasKey.html +0 -137
  25. data/doc/Mocha/ParameterMatchers/HasValue.html +0 -137
  26. data/doc/Mocha/ParameterMatchers/Includes.html +0 -137
  27. data/doc/Mocha/ParameterMatchers/InstanceOf.html +0 -137
  28. data/doc/Mocha/ParameterMatchers/IsA.html +0 -136
  29. data/doc/Mocha/ParameterMatchers/KindOf.html +0 -137
  30. data/doc/Mocha/ParameterMatchers/Not.html +0 -137
  31. data/doc/Mocha/ParameterMatchers/Optionally.html +0 -136
  32. data/doc/Mocha/ParameterMatchers/QueryStringMatches.html +0 -136
  33. data/doc/Mocha/ParameterMatchers/RegexpMatches.html +0 -137
  34. data/doc/Mocha/ParameterMatchers/RespondsWith.html +0 -137
  35. data/doc/Mocha/ParameterMatchers/YamlEquivalent.html +0 -137
  36. data/doc/Mocha/Sequence.html +0 -133
  37. data/doc/Mocha/StateMachine.html +0 -510
  38. data/doc/Mocha/StateMachine/State.html +0 -125
  39. data/doc/Mocha/StateMachine/StatePredicate.html +0 -125
  40. data/doc/Mocha/StubbingError.html +0 -134
  41. data/doc/Mocha/UnexpectedInvocation.html +0 -124
  42. data/doc/_index.html +0 -481
  43. data/doc/class_list.html +0 -47
  44. data/doc/css/common.css +0 -1
  45. data/doc/css/full_list.css +0 -55
  46. data/doc/css/style.css +0 -322
  47. data/doc/file.COPYING.html +0 -72
  48. data/doc/file.MIT-LICENSE.html +0 -86
  49. data/doc/file.README.html +0 -153
  50. data/doc/file.RELEASE.html +0 -954
  51. data/doc/file.misc.html +0 -108
  52. data/doc/file.mocha.html +0 -90
  53. data/doc/file.stubba.html +0 -129
  54. data/doc/file_list.html +0 -67
  55. data/doc/frames.html +0 -13
  56. data/doc/index.html +0 -153
  57. data/doc/js/app.js +0 -205
  58. data/doc/js/full_list.js +0 -173
  59. data/doc/js/jquery.js +0 -16
  60. data/doc/method_list.html +0 -510
  61. data/doc/top-level-namespace.html +0 -105
@@ -1,108 +0,0 @@
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.3
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 Wed Apr 25 16:51:30 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>
@@ -1,90 +0,0 @@
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.3
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 Wed Apr 25 16:51:30 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>
@@ -1,129 +0,0 @@
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.3
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 Wed Apr 25 16:51:30 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>
@@ -1,67 +0,0 @@
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>
@@ -1,13 +0,0 @@
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.3</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>
@@ -1,153 +0,0 @@
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.3
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, 0.10.3 &amp; 0.11.0 included a bug. Please do
106
- not use 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 Wed Apr 25 16:51:30 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>