public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
Search Repo:
Don't fallback to just adding "'s" in TextHelper#pluralize, 
because the Inflector is always loaded.
josh (author)
Wed May 14 12:34:28 -0700 2008
commit  603c853a340c9dbf6a959e74116487b870b7a893
tree    750975b484cf4454222962290a81537f805cbc11
parent  bc3cc91a3f53816cc205f791cba34514ce0a113e
...
3
4
5
6
7
8
 
 
 
9
10
11
12
13
 
 
 
 
14
15
16
17
18
 
 
19
20
21
22
23
...
30
31
32
33
 
34
35
36
37
38
 
39
40
41
 
42
43
44
45
46
47
48
...
63
64
65
66
 
67
68
69
70
71
 
72
73
74
75
 
76
77
 
78
79
 
80
81
82
83
84
85
86
...
89
90
91
92
 
93
94
95
96
97
98
99
 
100
101
102
 
103
104
105
 
106
107
108
 
109
110
111
112
113
114
115
...
147
148
149
150
151
152
153
 
 
 
154
155
156
 
157
158
159
 
160
161
162
 
163
164
165
166
167
168
169
170
171
172
173
174
175
176
 
177
178
179
...
229
230
231
232
 
233
234
235
236
237
238
239
240
...
273
274
275
276
 
277
278
279
280
 
281
282
283
284
285
286
287
 
288
289
 
290
291
292
 
293
294
 
295
296
297
298
299
300
...
316
317
318
319
 
320
321
322
 
 
323
324
325
326
 
327
328
329
330
331
 
332
333
334
335
...
338
339
340
341
 
342
343
 
344
345
346
347
348
...
349
350
351
352
 
353
354
355
356
357
 
 
 
 
358
359
360
 
361
362
363
...
370
371
372
373
374
 
 
375
376
377
...
401
402
403
404
405
 
 
406
407
408
409
...
428
429
430
431
 
432
433
434
435
436
 
437
438
439
...
453
454
455
456
 
457
458
459
460
...
462
463
464
465
 
466
467
468
469
470
471
 
472
473
474
...
502
503
504
505
 
506
507
508
...
3
4
5
 
 
 
6
7
8
9
 
 
 
 
10
11
12
13
14
15
16
 
 
17
18
19
20
21
22
23
...
30
31
32
 
33
34
35
36
37
 
38
39
40
 
41
42
43
44
45
46
47
48
...
63
64
65
 
66
67
68
69
70
 
71
72
73
74
 
75
76
 
77
78
 
79
80
81
82
83
84
85
86
...
89
90
91
 
92
93
94
95
96
97
98
 
99
100
101
 
102
103
104
 
105
106
107
 
108
109
110
111
112
113
114
115
...
147
148
149
 
 
 
 
150
151
152
153
154
 
155
156
157
 
158
159
160
 
161
162
163
164
165
166
 
 
 
 
 
 
 
 
 
167
168
169
170
...
220
221
222
 
223
224
225
226
227
228
229
230
231
...
264
265
266
 
267
268
269
270
 
271
272
273
274
275
276
277
 
278
279
 
280
281
282
 
283
284
 
285
286
287
288
289
290
291
...
307
308
309
 
310
311
 
 
312
313
314
315
316
 
317
318
319
320
321
 
322
323
324
325
326
...
329
330
331
 
332
333
 
334
335
336
337
338
339
...
340
341
342
 
343
344
 
 
 
 
345
346
347
348
349
350
 
351
352
353
354
...
361
362
363
 
 
364
365
366
367
368
...
392
393
394
 
 
395
396
397
398
399
400
...
419
420
421
 
422
423
424
425
426
 
427
428
429
430
...
444
445
446
 
447
448
449
450
451
...
453
454
455
 
456
457
458
459
460
461
 
462
463
464
465
...
493
494
495
 
496
497
498
499
0
@@ -3,19 +3,19 @@
0
 
0
 module ActionView
0
   module Helpers #:nodoc:
0
- # The TextHelper module provides a set of methods for filtering, formatting
0
- # and transforming strings, which can reduce the amount of inline Ruby code in
0
- # your views. These helper methods extend ActionView making them callable
0
+ # The TextHelper module provides a set of methods for filtering, formatting
0
+ # and transforming strings, which can reduce the amount of inline Ruby code in
0
+ # your views. These helper methods extend ActionView making them callable
0
     # within your template files.
0
- module TextHelper
0
- # The preferred method of outputting text in your views is to use the
0
- # <%= "text" %> eRuby syntax. The regular _puts_ and _print_ methods
0
- # do not operate as expected in an eRuby code block. If you absolutely must
0
+ module TextHelper
0
+ # The preferred method of outputting text in your views is to use the
0
+ # <%= "text" %> eRuby syntax. The regular _puts_ and _print_ methods
0
+ # do not operate as expected in an eRuby code block. If you absolutely must
0
       # output text within a non-output code block (i.e., <% %>), you can use the concat method.
0
       #
0
       # ==== Examples
0
- # <%
0
- # concat "hello", binding
0
+ # <%
0
+ # concat "hello", binding
0
       # # is the equivalent of <%= "hello" %>
0
       #
0
       # if (logged_in == true):
0
0
0
@@ -30,15 +30,15 @@
0
       end
0
 
0
       if RUBY_VERSION < '1.9'
0
- # If +text+ is longer than +length+, +text+ will be truncated to the length of
0
+ # If +text+ is longer than +length+, +text+ will be truncated to the length of
0
         # +length+ (defaults to 30) and the last characters will be replaced with the +truncate_string+
0
         # (defaults to "...").
0
         #
0
         # ==== Examples
0
- # truncate("Once upon a time in a world far far away", 14)
0
+ # truncate("Once upon a time in a world far far away", 14)
0
         # # => Once upon a...
0
         #
0
- # truncate("Once upon a time in a world far far away")
0
+ # truncate("Once upon a time in a world far far away")
0
         # # => Once upon a time in a world f...
0
         #
0
         # truncate("And they found that many people were sleeping better.", 25, "(clipped)")
0
0
0
0
0
@@ -63,20 +63,20 @@
0
       end
0
 
0
       # Highlights one or more +phrases+ everywhere in +text+ by inserting it into
0
- # a +highlighter+ string. The highlighter can be specialized by passing +highlighter+
0
+ # a +highlighter+ string. The highlighter can be specialized by passing +highlighter+
0
       # as a single-quoted string with \1 where the phrase is to be inserted (defaults to
0
       # '<strong class="highlight">\1</strong>')
0
       #
0
       # ==== Examples
0
- # highlight('You searched for: rails', 'rails')
0
+ # highlight('You searched for: rails', 'rails')
0
       # # => You searched for: <strong class="highlight">rails</strong>
0
       #
0
       # highlight('You searched for: ruby, rails, dhh', 'actionpack')
0
- # # => You searched for: ruby, rails, dhh
0
+ # # => You searched for: ruby, rails, dhh
0
       #
0
- # highlight('You searched for: rails', ['for', 'rails'], '<em>\1</em>')
0
+ # highlight('You searched for: rails', ['for', 'rails'], '<em>\1</em>')
0
       # # => You searched <em>for</em>: <em>rails</em>
0
- #
0
+ #
0
       # highlight('You searched for: rails', 'rails', "<a href='search?q=\1'>\1</a>")
0
       # # => You searched for: <a href='search?q=rails>rails</a>
0
       def highlight(text, phrases, highlighter = '<strong class="highlight">\1</strong>')
0
0
0
0
0
@@ -89,23 +89,23 @@
0
       end
0
 
0
       if RUBY_VERSION < '1.9'
0
- # Extracts an excerpt from +text+ that matches the first instance of +phrase+.
0
+ # Extracts an excerpt from +text+ that matches the first instance of +phrase+.
0
         # The +radius+ expands the excerpt on each side of the first occurrence of +phrase+ by the number of characters
0
         # defined in +radius+ (which defaults to 100). If the excerpt radius overflows the beginning or end of the +text+,
0
         # then the +excerpt_string+ will be prepended/appended accordingly. The resulting string will be stripped in any case.
0
         # If the +phrase+ isn't found, nil is returned.
0
         #
0
         # ==== Examples
0
- # excerpt('This is an example', 'an', 5)
0
+ # excerpt('This is an example', 'an', 5)
0
         # # => "...s is an exam..."
0
         #
0
- # excerpt('This is an example', 'is', 5)
0
+ # excerpt('This is an example', 'is', 5)
0
         # # => "This is a..."
0
         #
0
- # excerpt('This is an example', 'is')
0
+ # excerpt('This is an example', 'is')
0
         # # => "This is an example"
0
         #
0
- # excerpt('This next thing is an example', 'ex', 2)
0
+ # excerpt('This next thing is an example', 'ex', 2)
0
         # # => "...next..."
0
         #
0
         # excerpt('This is also an example', 'an', 8, '<chop> ')
0
0
0
0
0
@@ -147,33 +147,24 @@
0
         end
0
       end
0
 
0
- # Attempts to pluralize the +singular+ word unless +count+ is 1. If +plural+
0
- # is supplied, it will use that when count is > 1, if the ActiveSupport Inflector
0
- # is loaded, it will use the Inflector to determine the plural form, otherwise
0
- # it will just add an 's' to the +singular+ word.
0
+ # Attempts to pluralize the +singular+ word unless +count+ is 1. If
0
+ # +plural+ is supplied, it will use that when count is > 1, otherwise
0
+ # it will use the Inflector to determine the plural form
0
       #
0
       # ==== Examples
0
- # pluralize(1, 'person')
0
+ # pluralize(1, 'person')
0
       # # => 1 person
0
       #
0
- # pluralize(2, 'person')
0
+ # pluralize(2, 'person')
0
       # # => 2 people
0
       #
0
- # pluralize(3, 'person', 'users')
0
+ # pluralize(3, 'person', 'users')
0
       # # => 3 users
0
       #
0
       # pluralize(0, 'person')
0
       # # => 0 people
0
       def pluralize(count, singular, plural = nil)
0
- "#{count || 0} " + if count == 1 || count == '1'
0
- singular
0
- elsif plural
0
- plural
0
- elsif Object.const_defined?("Inflector")
0
- Inflector.pluralize(singular)
0
- else
0
- singular + "s"
0
- end
0
+ "#{count || 0} " + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))
0
       end
0
 
0
       # Wraps the +text+ into lines no longer than +line_width+ width. This method
0
@@ -229,7 +220,7 @@
0
           end
0
         end
0
 
0
- # Returns the text with all the Textile codes turned into HTML tags,
0
+ # Returns the text with all the Textile codes turned into HTML tags,
0
         # but without the bounding <p> tag that RedCloth adds.
0
         #
0
         # You can learn more about Textile's syntax at its website[http://www.textism.com/tools/textile].
0
0
0
0
0
0
@@ -273,25 +264,25 @@
0
         # # => "<p>We like to <em>write</em> <code>code</code>, not just <em>read</em> it!</p>"
0
         #
0
         # markdown("The [Markdown website](http://daringfireball.net/projects/markdown/) has more information.")
0
- # # => "<p>The <a href="http://daringfireball.net/projects/markdown/">Markdown website</a>
0
+ # # => "<p>The <a href="http://daringfireball.net/projects/markdown/">Markdown website</a>
0
         # # has more information.</p>"
0
         #
0
         # markdown('![The ROR logo](http://rubyonrails.com/images/rails.png "Ruby on Rails")')
0
- # # => '<p><img src="http://rubyonrails.com/images/rails.png" alt="The ROR logo" title="Ruby on Rails" /></p>'
0
+ # # => '<p><img src="http://rubyonrails.com/images/rails.png" alt="The ROR logo" title="Ruby on Rails" /></p>'
0
         def markdown(text)
0
           text.blank? ? "" : BlueCloth.new(text).to_html
0
         end
0
       rescue LoadError
0
         # We can't really help what's not there
0
       end
0
-
0
+
0
       # Returns +text+ transformed into HTML using simple formatting rules.
0
- # Two or more consecutive newlines(<tt>\n\n</tt>) are considered as a
0
+ # Two or more consecutive newlines(<tt>\n\n</tt>) are considered as a
0
       # paragraph and wrapped in <tt><p></tt> tags. One newline (<tt>\n</tt>) is
0
       # considered as a linebreak and a <tt><br /></tt> tag is appended. This
0
- # method does not remove the newlines from the +text+.
0
+ # method does not remove the newlines from the +text+.
0
       #
0
- # You can pass any HTML attributes into <tt>html_options</tt>. These
0
+ # You can pass any HTML attributes into <tt>html_options</tt>. These
0
       # will be added to all created paragraphs.
0
       # ==== Examples
0
       # my_text = "Here is some basic text...\n...with a line break."
0
0
0
0
@@ -316,19 +307,19 @@
0
         text << "</p>"
0
       end
0
 
0
- # Turns all URLs and e-mail addresses into clickable links. The +link+ parameter
0
+ # Turns all URLs and e-mail addresses into clickable links. The +link+ parameter
0
       # will limit what should be linked. You can add HTML attributes to the links using
0
- # +href_options+. Options for +link+ are <tt>:all</tt> (default),
0
- # <tt>:email_addresses</tt>, and <tt>:urls</tt>. If a block is given, each URL and
0
+ # +href_options+. Options for +link+ are <tt>:all</tt> (default),
0
+ # <tt>:email_addresses</tt>, and <tt>:urls</tt>. If a block is given, each URL and
0
       # e-mail address is yielded and the result is used as the link text.
0
       #
0
       # ==== Examples
0
- # auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
0
+ # auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
0
       # # => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
0
       # # say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
0
       #
0
       # auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :urls)
0
- # # => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
0
+ # # => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
0
       # # or e-mail david@loudthinking.com"
0
       #
0
       # auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :email_addresses)
0
0
@@ -338,9 +329,9 @@
0
       # auto_link(post_body, :all, :target => '_blank') do |text|
0
       # truncate(text, 15)
0
       # end
0
- # # => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>.
0
+ # # => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>.
0
       # Please e-mail me at <a href=\"mailto:me@email.com\">me@email.com</a>."
0
- #
0
+ #
0
       def auto_link(text, link = :all, href_options = {}, &block)
0
         return '' if text.blank?
0
         case link
0
0
0
@@ -349,15 +340,15 @@
0
           when :urls then auto_link_urls(text, href_options, &block)
0
         end
0
       end
0
-
0
+
0
       # Creates a Cycle object whose _to_s_ method cycles through elements of an
0
- # array every time it is called. This can be used for example, to alternate
0
- # classes for table rows. You can use named cycles to allow nesting in loops.
0
- # Passing a Hash as the last parameter with a <tt>:name</tt> key will create a
0
- # named cycle. You can manually reset a cycle by calling reset_cycle and passing the
0
+ # array every time it is called. This can be used for example, to alternate
0
+ # classes for table rows. You can use named cycles to allow nesting in loops.
0
+ # Passing a Hash as the last parameter with a <tt>:name</tt> key will create a
0
+ # named cycle. You can manually reset a cycle by calling reset_cycle and passing the
0
       # name of the cycle.
0
       #
0
- # ==== Examples
0
+ # ==== Examples
0
       # # Alternate CSS classes for even and odd numbers...
0
       # @items = [1,2,3,4]
0
       # <table>
0
@@ -370,8 +361,8 @@
0
       #
0
       #
0
       # # Cycle CSS classes for rows, and text colors for values within each row
0
- # @items = x = [{:first => 'Robert', :middle => 'Daniel', :last => 'James'},
0
- # {:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'},
0
+ # @items = x = [{:first => 'Robert', :middle => 'Daniel', :last => 'James'},
0
+ # {:first => 'Emily', :middle => 'Shannon', :maiden => 'Pike', :last => 'Hicks'},
0
       # {:first => 'June', :middle => 'Dae', :last => 'Jones'}]
0
       # <% @items.each do |item| %>
0
       # <tr class="<%= cycle("even", "odd", :name => "row_class") -%>">
0
@@ -401,8 +392,8 @@
0
         end
0
         return cycle.to_s
0
       end
0
-
0
- # Resets a cycle so that it starts from the first element the next time
0
+
0
+ # Resets a cycle so that it starts from the first element the next time
0
       # it is called. Pass in +name+ to reset a named cycle.
0
       #
0
       # ==== Example
0
0
@@ -428,12 +419,12 @@
0
 
0
       class Cycle #:nodoc:
0
         attr_reader :values
0
-
0
+
0
         def initialize(first_value, *values)
0
           @values = values.unshift(first_value)
0
           reset
0
         end
0
-
0
+
0
         def reset
0
           @index = 0
0
         end
0
@@ -453,7 +444,7 @@
0
           @_cycles = Hash.new unless defined?(@_cycles)
0
           return @_cycles[name]
0
         end
0
-
0
+
0
         def set_cycle(name, cycle_object)
0
           @_cycles = Hash.new unless defined?(@_cycles)
0
           @_cycles[name] = cycle_object
0
0
@@ -462,13 +453,13 @@
0
         AUTO_LINK_RE = %r{
0
                         ( # leading text
0
                           <\w+.*?>| # leading HTML tag, or
0
- [^=!:'"/]| # leading punctuation, or
0
+ [^=!:'"/]| # leading punctuation, or
0
                           ^ # beginning of line
0
                         )
0
                         (
0
                           (?:https?://)| # protocol spec, or
0
                           (?:www\.) # www.*
0
- )
0
+ )
0
                         (
0
                           [-\w]+ # subdomain or domain
0
                           (?:\.[-\w]+)* # remaining subdomains or domain
0
@@ -502,7 +493,7 @@
0
           body = text.dup
0
           text.gsub(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
0
             text = $1
0
-
0
+
0
             if body.match(/<a\b[^>]*>(.*)(#{Regexp.escape(text)})(.*)<\/a>/)
0
               text
0
             else
...
23
24
25
26
 
27
28
 
29
30
31
...
41
42
43
44
 
45
46
47
...
73
74
75
76
 
77
78
79
80
...
166
167
168
169
 
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
298
299
300
301
 
302
303
304
305
...
311
312
313
314
 
315
316
317
318
 
319
320
321
...
325
326
327
328
 
329
330
331
332
333
334
...
334
335
336
337
 
338
339
340
341
342
343
 
344
345
346
347
348
349
350
 
351
352
353
354
 
355
356
357
...
361
362
363
364
 
365
366
367
...
23
24
25
 
26
27
 
28
29
30
31
...
41
42
43
 
44
45
46
47
...
73
74
75
 
76
77
78
79
80
...
166
167
168
 
169
170
171
 
 
 
 
 
 
 
 
 
 
 
172
173
174
...
287
288
289
 
290
291
292
293
294
...
300
301
302
 
303
304
305
306
 
307
308
309
310
...
314
315
316
 
317
318
319
320
321
322
323
...
323
324
325
 
326
327
328
329
330
331
 
332
333
334
335
336
337
338
 
339
340
341
342
 
343
344
345
346
...
350
351
352
 
353
354
355
356
0
@@ -23,9 +23,9 @@
0
 
0
     text = "A\r\n \nB\n\n\r\n\t\nC\nD".freeze
0
     assert_equal "<p>A\n<br /> \n<br />B</p>\n\n<p>\t\n<br />C\n<br />D</p>", simple_format(text)
0
-
0
+
0
      assert_equal %q(<p class="test">This is a classy test</p>), simple_format("This is a classy test", :class => 'test')
0
- assert_equal %Q(<p class="test">para 1</p>\n\n<p class="test">para 2</p>), simple_format("para 1\n\npara 2", :class => 'test')
0
+ assert_equal %Q(<p class="test">para 1</p>\n\n<p class="test">para 2</p>), simple_format("para 1\n\npara 2", :class => 'test')
0
   end
0
 
0
   def test_truncate
0
@@ -41,7 +41,7 @@
0
   if RUBY_VERSION < '1.9.0'
0
     def test_truncate_multibyte
0
       with_kcode 'none' do
0
- assert_equal "\354\225\210\353\205\225\355...", truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", 10)
0
+ assert_equal "\354\225\210\353\205\225\355...", truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", 10)
0
       end
0
       with_kcode 'u' do
0
         assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...",
0
@@ -73,7 +73,7 @@
0
       "This is a <b>beautiful</b> morning, but also a <b>beautiful</b> day",
0
       highlight("This is a beautiful morning, but also a beautiful day", "beautiful", '<b>\1</b>')
0
     )
0
-
0
+
0
     assert_equal(
0
       "This text is not changed because we supplied an empty phrase",
0
       highlight("This text is not changed because we supplied an empty phrase", nil)
0
0
@@ -166,20 +166,9 @@
0
     assert_equal("2 counters", pluralize(2, "count", "counters"))
0
     assert_equal("0 counters", pluralize(nil, "count", "counters"))
0
     assert_equal("2 people", pluralize(2, "person"))
0
- assert_equal("10 buffaloes", pluralize(10, "buffalo"))
0
+ assert_equal("10 buffaloes", pluralize(10, "buffalo"))
0
   end
0
 
0
- uses_mocha("should_just_add_s_for_pluralize_without_inflector_loaded") do
0
- def test_should_just_add_s_for_pluralize_without_inflector_loaded
0
- Object.expects(:const_defined?).with("Inflector").times(4).returns(false)
0
- assert_equal("1 count", pluralize(1, "count"))
0
- assert_equal("2 persons", pluralize(2, "person"))
0
- assert_equal("2 personss", pluralize("2", "persons"))
0
- assert_equal("2 counts", pluralize(2, "count"))
0
- assert_equal("10 buffalos", pluralize(10, "buffalo"))
0
- end
0
- end
0
-
0
   def test_auto_link_parsing
0
     urls = %w(http://www.rubyonrails.com
0
               http://www.rubyonrails.com:80
0
@@ -298,7 +287,7 @@
0
     assert_equal("2", value.to_s)
0
     assert_equal("3", value.to_s)
0
   end
0
-
0
+
0
   def test_cycle_class_with_no_arguments
0
     assert_raise(ArgumentError) { value = Cycle.new() }
0
   end
0
0
@@ -311,11 +300,11 @@
0
     assert_equal("2", cycle("one", 2, "3"))
0
     assert_equal("3", cycle("one", 2, "3"))
0
   end
0
-
0
+
0
   def test_cycle_with_no_arguments
0
     assert_raise(ArgumentError) { value = cycle() }
0
   end
0
-
0
+
0
   def test_cycle_resets_with_new_values
0
     assert_equal("even", cycle("even", "odd"))
0
     assert_equal("odd", cycle("even", "odd"))
0
@@ -325,7 +314,7 @@
0
     assert_equal("3", cycle(1, 2, 3))
0
     assert_equal("1", cycle(1, 2, 3))
0
   end
0
-
0
+
0
   def test_named_cycles
0
     assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
0
     assert_equal("red", cycle("red", "blue", :name => "colors"))
0
0
0
0
@@ -334,24 +323,24 @@
0
     assert_equal("3", cycle(1, 2, 3, :name => "numbers"))
0
     assert_equal("red", cycle("red", "blue", :name => "colors"))
0
   end
0
-
0
+
0
   def test_default_named_cycle
0
     assert_equal("1", cycle(1, 2, 3))
0
     assert_equal("2", cycle(1, 2, 3, :name => "default"))
0
     assert_equal("3", cycle(1, 2, 3))
0
   end
0
-
0
+
0
   def test_reset_cycle
0
     assert_equal("1", cycle(1, 2, 3))
0
     assert_equal("2", cycle(1, 2, 3))
0
     reset_cycle
0
     assert_equal("1", cycle(1, 2, 3))
0
   end
0
-
0
+
0
   def test_reset_unknown_cycle
0
     reset_cycle("colors")
0
   end
0
-
0
+
0
   def test_recet_named_cycle
0
     assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
0
     assert_equal("red", cycle("red", "blue", :name => "colors"))
0
@@ -361,7 +350,7 @@
0
     assert_equal("2", cycle(1, 2, 3, :name => "numbers"))
0
     assert_equal("red", cycle("red", "blue", :name => "colors"))
0
   end
0
-
0
+
0
   def test_cycle_no_instance_variable_clashes
0
     @cycles = %w{Specialized Fuji Giant}
0
     assert_equal("red", cycle("red", "blue"))

Comments

    No one has commented yet.