motiro 0.6.9 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/README +1 -1
  2. data/Rakefile +2 -2
  3. data/app/core/version.rb +1 -1
  4. data/app/helpers/feed_helper.rb +2 -0
  5. data/app/reporters/darcs_reporter.rb +2 -3
  6. data/app/views/events/new.rhtml +14 -0
  7. data/app/views/feed/subversion.rhtml +26 -0
  8. data/app/views/report/events_detail.rhtml +12 -0
  9. data/build/build.rb +29 -0
  10. data/config/boot.rb +104 -14
  11. data/config/environment.rb +35 -38
  12. data/config/environments/development.rb +5 -7
  13. data/config/environments/production.rb +3 -3
  14. data/config/environments/test.rb +5 -2
  15. data/config/initializers/globalize.rb +5 -0
  16. data/config/initializers/inflections.rb +10 -0
  17. data/config/initializers/mime_types.rb +5 -0
  18. data/config/initializers/motiro_core.rb +5 -0
  19. data/config/motiro.yml +4 -4
  20. data/config/report/subversion.yml +26 -0
  21. data/doc/README_FOR_APP +1 -1
  22. data/lib/login_system.rb +2 -2
  23. data/lib/tasks/packaging.rake +4 -4
  24. data/public/404.html +27 -5
  25. data/public/422.html +30 -0
  26. data/public/500.html +27 -5
  27. data/public/dispatch.rb +2 -2
  28. data/public/javascripts/application.js +2 -0
  29. data/public/javascripts/controls.js +532 -319
  30. data/public/javascripts/dragdrop.js +521 -133
  31. data/public/javascripts/effects.js +708 -442
  32. data/public/javascripts/prototype.js +3393 -953
  33. data/public/robots.txt +5 -1
  34. data/public/selenium/tests/TestMainPage.html +42 -0
  35. data/public/selenium/tests/TestReportHTML.html +42 -0
  36. data/public/selenium/tests/TestReportRSS.html +37 -0
  37. data/public/selenium/tests/TestSubversionOnMain.html +32 -0
  38. data/public/selenium/tests/TestSuite.html +26 -0
  39. data/script/about +1 -1
  40. data/script/console +1 -1
  41. data/script/destroy +1 -1
  42. data/script/generate +1 -1
  43. data/script/performance/request +3 -0
  44. data/script/plugin +1 -1
  45. data/script/process/inspector +3 -0
  46. data/script/runner +1 -1
  47. data/script/server +1 -1
  48. data/test/fixtures/headlines.yml +6 -6
  49. data/test/functional/report_controller_test.rb +18 -18
  50. data/test/functional/root_controller_test.rb +1 -1
  51. data/test/test_helper.rb +11 -1
  52. data/test/unit/chief_editor_test.rb +20 -26
  53. data/test/unit/darcs_reporter_test.rb +6 -0
  54. data/test/unit/headline_test.rb +25 -8
  55. data/vendor/plugins/cache_test-0.2/doc/classes/Cosinux/FragmentCacheTest/Assertions.html +364 -0
  56. data/vendor/plugins/cache_test-0.2/doc/classes/Cosinux/PageCacheTest/IntegrationTestMethods.html +261 -0
  57. data/vendor/plugins/cache_test-0.2/doc/created.rid +1 -0
  58. data/vendor/plugins/cache_test-0.2/doc/files/CHANGELOG.html +128 -0
  59. data/vendor/plugins/cache_test-0.2/doc/files/MIT-LICENSE.html +129 -0
  60. data/vendor/plugins/cache_test-0.2/doc/files/README.html +272 -0
  61. data/vendor/plugins/cache_test-0.2/doc/files/init_rb.html +109 -0
  62. data/vendor/plugins/cache_test-0.2/doc/files/lib/fragment_cache_test_rb.html +101 -0
  63. data/vendor/plugins/cache_test-0.2/doc/files/lib/page_cache_test_rb.html +101 -0
  64. data/vendor/plugins/cache_test-0.2/doc/fr_class_index.html +28 -0
  65. data/vendor/plugins/cache_test-0.2/doc/fr_file_index.html +32 -0
  66. data/vendor/plugins/cache_test-0.2/doc/fr_method_index.html +32 -0
  67. data/vendor/plugins/cache_test-0.2/doc/index.html +24 -0
  68. data/vendor/plugins/cache_test-0.2/doc/rdoc-style.css +208 -0
  69. data/vendor/plugins/caching_monkey_patch/init.rb +13 -0
  70. data/vendor/plugins/rails_cron/CHANGELOG +8 -0
  71. data/vendor/plugins/rails_cron/LICENSE +7 -0
  72. data/vendor/plugins/rails_cron/README +77 -0
  73. data/vendor/plugins/rails_cron/init.rb +16 -0
  74. data/vendor/plugins/rails_cron/lib/acts_as_background.rb +14 -0
  75. data/vendor/plugins/rails_cron/lib/rails_cron.rb +128 -0
  76. data/vendor/plugins/rails_cron/tasks/startup.rake +50 -0
  77. metadata +466 -406
@@ -140,7 +140,13 @@ class DarcsReporterTest < Test::Unit::TestCase
140
140
  assert changes[1].diff.match(/@@ -76,6 \+76,17 @@/)
141
141
  assert changes[1].diff.match(/^\+\t\tmultiplexer.addOutput\(output\);/)
142
142
  assert changes[1].diff.match(/Writer multiplexer = new MultiplexedWriter\(outputs\);\n\n/)
143
+ end
143
144
 
145
+ def test_accepts_author_identifiers_that_are_not_email_addresses
146
+ assert_equal 'thiago.arrais',
147
+ @reporter.author_from_darcs_id('thiago.arrais@gmail.com')
148
+ assert_equal 'tbasouza',
149
+ @reporter.author_from_darcs_id('tbasouza')
144
150
  end
145
151
 
146
152
  end
@@ -1,3 +1,20 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+
1
18
  require File.dirname(__FILE__) + '/../test_helper'
2
19
 
3
20
  class HeadlineTest < Test::Unit::TestCase
@@ -19,9 +36,9 @@ class HeadlineTest < Test::Unit::TestCase
19
36
  end
20
37
 
21
38
  def test_cached
22
- svn_demo_headline = headlines('svn_demo_headline')
23
- headline = Headline.new(:author => svn_demo_headline.author,
24
- :description => svn_demo_headline.description,
39
+ demo_headline = headlines('demo_headline')
40
+ headline = Headline.new(:author => demo_headline.author,
41
+ :description => demo_headline.description,
25
42
  :happened_at => [2006, 03, 23, 11, 10, 04])
26
43
 
27
44
  assert headline.cached?
@@ -80,12 +97,12 @@ class HeadlineTest < Test::Unit::TestCase
80
97
  end
81
98
 
82
99
  def test_search_by_reporter_name_and_rid
83
- svn_demo_headline = headlines('svn_demo_headline')
84
- aHeadline = Headline.find_with_reporter_and_rid(svn_demo_headline.reported_by,
85
- svn_demo_headline.rid)
100
+ demo_headline = headlines('demo_headline')
101
+ aHeadline = Headline.find_with_reporter_and_rid(demo_headline.reported_by,
102
+ demo_headline.rid)
86
103
 
87
104
  assert_not_nil aHeadline
88
- assert_equal svn_demo_headline, aHeadline
105
+ assert_equal demo_headline, aHeadline
89
106
  end
90
107
 
91
108
  def test_not_filled
@@ -232,7 +249,7 @@ class HeadlineTest < Test::Unit::TestCase
232
249
  end
233
250
 
234
251
  def test_retrieves_latest_filled_headline
235
- hl = headlines(:svn_demo_headline)
252
+ hl = headlines('darcs_headline')
236
253
  assert_equal hl.rid, Headline.latest_filled_headline_rid_for(hl.reported_by)
237
254
  end
238
255
 
@@ -0,0 +1,364 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Cosinux::FragmentCacheTest::Assertions</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Cosinux::FragmentCacheTest::Assertions</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/fragment_cache_test_rb.html">
59
+ lib/fragment_cache_test.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ This module define method to validate the fragment and action caching logic
78
+ of your application in both integration and functional tests.
79
+ </p>
80
+ <h2>Testing action caching</h2>
81
+ <p>
82
+ To test caching of the &quot;bar&quot; action of the foo
83
+ &quot;controller&quot; in an integration test, do
84
+ </p>
85
+ <pre>
86
+ assert_cache_actions(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;) do
87
+ get &quot;/foo/bar&quot;
88
+ end
89
+ </pre>
90
+ <p>
91
+ The <a href="Assertions.html#M000003">assert_cache_actions</a> method will
92
+ </p>
93
+ <ul>
94
+ <li>first make sure that the actions are not cached,
95
+
96
+ </li>
97
+ <li>yield the given block
98
+
99
+ </li>
100
+ <li>assert that the corresponding action fragment have been stored.
101
+
102
+ </li>
103
+ </ul>
104
+ <h2>Testing expiring of actions</h2>
105
+ <p>
106
+ To check that some actions are expired, use the <a
107
+ href="Assertions.html#M000004">assert_expire_actions</a> method:
108
+ </p>
109
+ <pre>
110
+ assert_expire_actions(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;) do |*urls|
111
+ post &quot;/foo/expire_cache&quot;
112
+ end
113
+ </pre>
114
+ <p>
115
+ Here the <a href="Assertions.html#M000004">assert_expire_actions</a> method
116
+ will
117
+ </p>
118
+ <ul>
119
+ <li>check that the actions fragments are cached,
120
+
121
+ </li>
122
+ <li>execute the post request,
123
+
124
+ </li>
125
+ <li>and assert that the fragments are no more cached.
126
+
127
+ </li>
128
+ </ul>
129
+ <p>
130
+ In functional test, there can be only one controller, so you are not
131
+ required to give the :controller option and if they are no parameters to
132
+ the action, you can simply call
133
+ </p>
134
+ <pre>
135
+ assert_cache_actions(:foo, :bar) do
136
+ get :bar
137
+ get :foo
138
+ end
139
+ </pre>
140
+ <h2>Testing fragments caching</h2>
141
+ <p>
142
+ To check that your fragments are cached when doing some action, do
143
+ </p>
144
+ <pre>
145
+ assert_cache_fragments(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;, :action_suffix =&gt; &quot;baz&quot;) do
146
+ get &quot;/foo/bar&quot;
147
+ end
148
+ </pre>
149
+ <h2>Testing expiration of fragments</h2>
150
+ <p>
151
+ To check that your fragments are expired when doing some action, do
152
+ </p>
153
+ <pre>
154
+ assert_expire_fragments(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;, :action_suffix =&gt; &quot;baz&quot;) do
155
+ get &quot;/foo/expire&quot;
156
+ end
157
+ </pre>
158
+ <p>
159
+ In functional test, your not required to give the :controller option.
160
+ </p>
161
+
162
+ </div>
163
+
164
+
165
+ </div>
166
+
167
+ <div id="method-list">
168
+ <h3 class="section-bar">Methods</h3>
169
+
170
+ <div class="name-list">
171
+ <a href="#M000003">assert_cache_actions</a>&nbsp;&nbsp;
172
+ <a href="#M000001">assert_cache_fragments</a>&nbsp;&nbsp;
173
+ <a href="#M000004">assert_expire_actions</a>&nbsp;&nbsp;
174
+ <a href="#M000002">assert_expire_fragments</a>&nbsp;&nbsp;
175
+ </div>
176
+ </div>
177
+
178
+ </div>
179
+
180
+
181
+ <!-- if includes -->
182
+
183
+ <div id="section">
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <!-- if method_list -->
193
+ <div id="methods">
194
+ <h3 class="section-bar">Public Instance methods</h3>
195
+
196
+ <div id="method-M000003" class="method-detail">
197
+ <a name="M000003"></a>
198
+
199
+ <div class="method-heading">
200
+ <a href="#M000003" class="method-signature">
201
+ <span class="method-name">assert_cache_actions</span><span class="method-args">(*actions) {|*actions| ...}</span>
202
+ </a>
203
+ </div>
204
+
205
+ <div class="method-description">
206
+ <p>
207
+ assert that the given actions are being cached
208
+ </p>
209
+ <p><a class="source-toggle" href="#"
210
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
211
+ <div class="method-source-code" id="M000003-source">
212
+ <pre>
213
+ <span class="ruby-comment cmt"># File lib/fragment_cache_test.rb, line 158</span>
214
+ 158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_cache_actions</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">actions</span>)
215
+ 159: <span class="ruby-identifier">check_options_has_controller</span>(<span class="ruby-identifier">actions</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">IntegrationTest</span>)
216
+ 160:
217
+ 161: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">reset</span>
218
+ 162:
219
+ 163: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">actions</span>
220
+ 164:
221
+ 165: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoRequestInBlockError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;no request was send while executing block.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">nil?</span>
222
+ 166:
223
+ 167: <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span>
224
+ 168: <span class="ruby-identifier">action</span> = { <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">action</span> } <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
225
+ 169: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{action.inspect} is not cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
226
+ 170: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">written?</span>(<span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">fragment_cache_key</span>(<span class="ruby-identifier">action</span>))
227
+ 171: <span class="ruby-keyword kw">end</span>
228
+ 172: <span class="ruby-keyword kw">end</span>
229
+ 173: <span class="ruby-keyword kw">end</span>
230
+ </pre>
231
+ </div>
232
+ </div>
233
+ </div>
234
+
235
+ <div id="method-M000001" class="method-detail">
236
+ <a name="M000001"></a>
237
+
238
+ <div class="method-heading">
239
+ <a href="#M000001" class="method-signature">
240
+ <span class="method-name">assert_cache_fragments</span><span class="method-args">(*names) {|*names| ...}</span>
241
+ </a>
242
+ </div>
243
+
244
+ <div class="method-description">
245
+ <p>
246
+ asserts that the list of given fragment name are being cached
247
+ </p>
248
+ <p><a class="source-toggle" href="#"
249
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
250
+ <div class="method-source-code" id="M000001-source">
251
+ <pre>
252
+ <span class="ruby-comment cmt"># File lib/fragment_cache_test.rb, line 122</span>
253
+ 122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_cache_fragments</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">names</span>)
254
+ 123: <span class="ruby-comment cmt"># in integration test, we need the know the controller</span>
255
+ 124: <span class="ruby-identifier">check_options_has_controller</span>(<span class="ruby-identifier">names</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">IntegrationTest</span>)
256
+ 125:
257
+ 126: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">reset</span>
258
+ 127:
259
+ 128: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">names</span>
260
+ 129:
261
+ 130: <span class="ruby-comment cmt"># if there is no variable @controller, then we haven't done any request</span>
262
+ 131: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoRequestInBlockError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;no request was send while executing block.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">nil?</span>
263
+ 132:
264
+ 133: <span class="ruby-identifier">names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
265
+ 134: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{name.inspect} is not cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
266
+ 135: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">written?</span>(<span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">fragment_cache_key</span>(<span class="ruby-identifier">name</span>))
267
+ 136: <span class="ruby-keyword kw">end</span>
268
+ 137: <span class="ruby-keyword kw">end</span>
269
+ 138: <span class="ruby-keyword kw">end</span>
270
+ </pre>
271
+ </div>
272
+ </div>
273
+ </div>
274
+
275
+ <div id="method-M000004" class="method-detail">
276
+ <a name="M000004"></a>
277
+
278
+ <div class="method-heading">
279
+ <a href="#M000004" class="method-signature">
280
+ <span class="method-name">assert_expire_actions</span><span class="method-args">(*actions) {|*actions| ...}</span>
281
+ </a>
282
+ </div>
283
+
284
+ <div class="method-description">
285
+ <p>
286
+ assert that the given actions are being expired
287
+ </p>
288
+ <p><a class="source-toggle" href="#"
289
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
290
+ <div class="method-source-code" id="M000004-source">
291
+ <pre>
292
+ <span class="ruby-comment cmt"># File lib/fragment_cache_test.rb, line 176</span>
293
+ 176: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_expire_actions</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">actions</span>)
294
+ 177: <span class="ruby-identifier">check_options_has_controller</span>(<span class="ruby-identifier">actions</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">IntegrationTest</span>)
295
+ 178:
296
+ 179: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">reset</span>
297
+ 180:
298
+ 181: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">actions</span>
299
+ 182:
300
+ 183: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoRequestInBlockError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;no request was send while executing block.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">nil?</span>
301
+ 184:
302
+ 185: <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span>
303
+ 186: <span class="ruby-identifier">action</span> = { <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">action</span> } <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
304
+ 187: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{action.inspect} is cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
305
+ 188: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">deleted?</span>(<span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">fragment_cache_key</span>(<span class="ruby-identifier">action</span>))
306
+ 189: <span class="ruby-keyword kw">end</span>
307
+ 190: <span class="ruby-keyword kw">end</span>
308
+ 191: <span class="ruby-keyword kw">end</span>
309
+ </pre>
310
+ </div>
311
+ </div>
312
+ </div>
313
+
314
+ <div id="method-M000002" class="method-detail">
315
+ <a name="M000002"></a>
316
+
317
+ <div class="method-heading">
318
+ <a href="#M000002" class="method-signature">
319
+ <span class="method-name">assert_expire_fragments</span><span class="method-args">(*names) {|*names| ...}</span>
320
+ </a>
321
+ </div>
322
+
323
+ <div class="method-description">
324
+ <p>
325
+ assert that the list of given fragment are being expired
326
+ </p>
327
+ <p><a class="source-toggle" href="#"
328
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
329
+ <div class="method-source-code" id="M000002-source">
330
+ <pre>
331
+ <span class="ruby-comment cmt"># File lib/fragment_cache_test.rb, line 141</span>
332
+ 141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_expire_fragments</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">names</span>)
333
+ 142: <span class="ruby-identifier">check_options_has_controller</span>(<span class="ruby-identifier">names</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">IntegrationTest</span>)
334
+ 143:
335
+ 144: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">reset</span>
336
+ 145:
337
+ 146: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">names</span>
338
+ 147:
339
+ 148: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoRequestInBlockError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;no request was send while executing block.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">nil?</span>
340
+ 149:
341
+ 150: <span class="ruby-identifier">names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
342
+ 151: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{name.inspect} is cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
343
+ 152: <span class="ruby-identifier">fragment_cache_store</span>.<span class="ruby-identifier">deleted?</span>(<span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">fragment_cache_key</span>(<span class="ruby-identifier">name</span>))
344
+ 153: <span class="ruby-keyword kw">end</span>
345
+ 154: <span class="ruby-keyword kw">end</span>
346
+ 155: <span class="ruby-keyword kw">end</span>
347
+ </pre>
348
+ </div>
349
+ </div>
350
+ </div>
351
+
352
+
353
+ </div>
354
+
355
+
356
+ </div>
357
+
358
+
359
+ <div id="validator-badges">
360
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
361
+ </div>
362
+
363
+ </body>
364
+ </html>
@@ -0,0 +1,261 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Cosinux::PageCacheTest::IntegrationTestMethods</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Cosinux::PageCacheTest::IntegrationTestMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/page_cache_test_rb.html">
59
+ lib/page_cache_test.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ This module define method to validate the page caching logic of your
78
+ application in integration tests.
79
+ </p>
80
+ <h2>Testing page caching</h2>
81
+ <p>
82
+ To test caching of the &quot;/pages/about&quot; and
83
+ &quot;/pages/contact&quot; pages, add a method like this:
84
+ </p>
85
+ <pre>
86
+ def test_caching
87
+ assert_cache_pages(&quot;/pages/about&quot;, &quot;/pages/contact&quot;)
88
+ end
89
+ </pre>
90
+ <p>
91
+ The assert_cache method will
92
+ </p>
93
+ <ul>
94
+ <li>first make sure that the urls are not cached,
95
+
96
+ </li>
97
+ <li>execute a get on each request,
98
+
99
+ </li>
100
+ <li>assert that the corresponding cache files have been created.
101
+
102
+ </li>
103
+ </ul>
104
+ <p>
105
+ You can also give a block to the assert_cache method. Instead of executing
106
+ a get on each url, it will yield the urls. For example:
107
+ </p>
108
+ <pre>
109
+ def test_caching
110
+ assert_cache_pages(&quot;/pages/about&quot;, &quot;/pages/contact&quot;) do |url_about, url_contact|
111
+ post url_about
112
+ post url_contact
113
+ end
114
+ end
115
+ </pre>
116
+ <h2>Testing expiring of pages</h2>
117
+ <p>
118
+ You will also certainly want to check if your cached pages expires when the
119
+ user is doing some action. For that, here is the assert_expire method:
120
+ </p>
121
+ <pre>
122
+ def test_expiring
123
+ assert_expire_pages(&quot;/news/list&quot;, &quot;/news/show/1&quot;) do |*urls|
124
+ post &quot;/news/delete/1&quot;
125
+ end
126
+ end
127
+ </pre>
128
+ <p>
129
+ Here the <a
130
+ href="IntegrationTestMethods.html#M000006">assert_expire_pages</a> method
131
+ will
132
+ </p>
133
+ <ul>
134
+ <li>check that the urls are cached,
135
+
136
+ </li>
137
+ <li>execute the post request,
138
+
139
+ </li>
140
+ <li>and assert that the urls are no more cached.
141
+
142
+ </li>
143
+ </ul>
144
+
145
+ </div>
146
+
147
+
148
+ </div>
149
+
150
+ <div id="method-list">
151
+ <h3 class="section-bar">Methods</h3>
152
+
153
+ <div class="name-list">
154
+ <a href="#M000005">assert_cache_pages</a>&nbsp;&nbsp;
155
+ <a href="#M000006">assert_expire_pages</a>&nbsp;&nbsp;
156
+ </div>
157
+ </div>
158
+
159
+ </div>
160
+
161
+
162
+ <!-- if includes -->
163
+
164
+ <div id="section">
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <!-- if method_list -->
174
+ <div id="methods">
175
+ <h3 class="section-bar">Public Instance methods</h3>
176
+
177
+ <div id="method-M000005" class="method-detail">
178
+ <a name="M000005"></a>
179
+
180
+ <div class="method-heading">
181
+ <a href="#M000005" class="method-signature">
182
+ <span class="method-name">assert_cache_pages</span><span class="method-args">(*urls) {|*urls| ...}</span>
183
+ </a>
184
+ </div>
185
+
186
+ <div class="method-description">
187
+ <p>
188
+ asserts that the list of given url are being cached
189
+ </p>
190
+ <p><a class="source-toggle" href="#"
191
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
192
+ <div class="method-source-code" id="M000005-source">
193
+ <pre>
194
+ <span class="ruby-comment cmt"># File lib/page_cache_test.rb, line 110</span>
195
+ 110: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_cache_pages</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">urls</span>)
196
+ 111: <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">reset_cache</span>
197
+ 112:
198
+ 113: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
199
+ 114: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">urls</span>
200
+ 115: <span class="ruby-keyword kw">else</span>
201
+ 116: <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span> <span class="ruby-identifier">get</span> <span class="ruby-identifier">url</span> }
202
+ 117: <span class="ruby-keyword kw">end</span>
203
+ 118:
204
+ 119: <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span>
205
+ 120: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{url.inspect} is not cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
206
+ 121: <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">cached?</span>(<span class="ruby-identifier">url</span>)
207
+ 122: <span class="ruby-keyword kw">end</span>
208
+ 123: <span class="ruby-keyword kw">end</span>
209
+ 124: <span class="ruby-keyword kw">end</span>
210
+ </pre>
211
+ </div>
212
+ </div>
213
+ </div>
214
+
215
+ <div id="method-M000006" class="method-detail">
216
+ <a name="M000006"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="#M000006" class="method-signature">
220
+ <span class="method-name">assert_expire_pages</span><span class="method-args">(*urls) {|*urls| ...}</span>
221
+ </a>
222
+ </div>
223
+
224
+ <div class="method-description">
225
+ <p>
226
+ asserts that the list of given url are being expired
227
+ </p>
228
+ <p><a class="source-toggle" href="#"
229
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
230
+ <div class="method-source-code" id="M000006-source">
231
+ <pre>
232
+ <span class="ruby-comment cmt"># File lib/page_cache_test.rb, line 127</span>
233
+ 127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_expire_pages</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">urls</span>)
234
+ 128: <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">reset_cache</span>
235
+ 129:
236
+ 130: <span class="ruby-keyword kw">yield</span> <span class="ruby-operator">*</span><span class="ruby-identifier">urls</span>
237
+ 131:
238
+ 132: <span class="ruby-identifier">urls</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url</span><span class="ruby-operator">|</span>
239
+ 133: <span class="ruby-identifier">assert_block</span>(<span class="ruby-node">&quot;#{url.inspect} is cached after executing block&quot;</span>) <span class="ruby-keyword kw">do</span>
240
+ 134: <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">expired?</span>(<span class="ruby-identifier">url</span>)
241
+ 135: <span class="ruby-keyword kw">end</span>
242
+ 136: <span class="ruby-keyword kw">end</span>
243
+ 137: <span class="ruby-keyword kw">end</span>
244
+ </pre>
245
+ </div>
246
+ </div>
247
+ </div>
248
+
249
+
250
+ </div>
251
+
252
+
253
+ </div>
254
+
255
+
256
+ <div id="validator-badges">
257
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
258
+ </div>
259
+
260
+ </body>
261
+ </html>