Froze rails gems
[depot.git] / vendor / rails / actionpack / test / template / text_helper_test.rb
1 require 'abstract_unit'
2 require 'testing_sandbox'
3
4 class TextHelperTest < ActionView::TestCase
5 tests ActionView::Helpers::TextHelper
6 include TestingSandbox
7
8 def setup
9 # This simulates the fact that instance variables are reset every time
10 # a view is rendered. The cycle helper depends on this behavior.
11 @_cycles = nil if (defined? @_cycles)
12 end
13
14 def test_concat
15 self.output_buffer = 'foo'
16 assert_equal 'foobar', concat('bar')
17 assert_equal 'foobar', output_buffer
18 end
19
20 def test_simple_format
21 assert_equal "<p></p>", simple_format(nil)
22
23 assert_equal "<p>crazy\n<br /> cross\n<br /> platform linebreaks</p>", simple_format("crazy\r\n cross\r platform linebreaks")
24 assert_equal "<p>A paragraph</p>\n\n<p>and another one!</p>", simple_format("A paragraph\n\nand another one!")
25 assert_equal "<p>A paragraph\n<br /> With a newline</p>", simple_format("A paragraph\n With a newline")
26
27 text = "A\nB\nC\nD".freeze
28 assert_equal "<p>A\n<br />B\n<br />C\n<br />D</p>", simple_format(text)
29
30 text = "A\r\n \nB\n\n\r\n\t\nC\nD".freeze
31 assert_equal "<p>A\n<br /> \n<br />B</p>\n\n<p>\t\n<br />C\n<br />D</p>", simple_format(text)
32
33 assert_equal %q(<p class="test">This is a classy test</p>), simple_format("This is a classy test", :class => 'test')
34 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')
35 end
36
37 def test_truncate
38 assert_equal "Hello World!", truncate("Hello World!", :length => 12)
39 assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12)
40 end
41
42 def test_truncate_should_use_default_length_of_30
43 str = "This is a string that will go longer then the default truncate length of 30"
44 assert_equal str[0...27] + "...", truncate(str)
45 end
46
47 def test_truncate_with_options_hash
48 assert_equal "This is a string that wil[...]", truncate("This is a string that will go longer then the default truncate length of 30", :omission => "[...]")
49 assert_equal "Hello W...", truncate("Hello World!", :length => 10)
50 assert_equal "Hello[...]", truncate("Hello World!", :omission => "[...]", :length => 10)
51 end
52
53 if RUBY_VERSION < '1.9.0'
54 def test_truncate_multibyte
55 with_kcode 'none' do
56 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", :length => 10)
57 end
58 with_kcode 'u' do
59 assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...",
60 truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244", :length => 10)
61 end
62 end
63 else
64 def test_truncate_multibyte
65 assert_equal "\354\225\210\353\205\225\355...",
66 truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", :length => 10)
67
68 assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding('UTF-8'),
69 truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding('UTF-8'), :length => 10)
70 end
71 end
72
73 def test_highlighter
74 assert_equal(
75 "This is a <strong class=\"highlight\">beautiful</strong> morning",
76 highlight("This is a beautiful morning", "beautiful")
77 )
78
79 assert_equal(
80 "This is a <strong class=\"highlight\">beautiful</strong> morning, but also a <strong class=\"highlight\">beautiful</strong> day",
81 highlight("This is a beautiful morning, but also a beautiful day", "beautiful")
82 )
83
84 assert_equal(
85 "This is a <b>beautiful</b> morning, but also a <b>beautiful</b> day",
86 highlight("This is a beautiful morning, but also a beautiful day", "beautiful", '<b>\1</b>')
87 )
88
89 assert_equal(
90 "This text is not changed because we supplied an empty phrase",
91 highlight("This text is not changed because we supplied an empty phrase", nil)
92 )
93
94 assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
95 end
96
97 def test_highlight_with_regexp
98 assert_equal(
99 "This is a <strong class=\"highlight\">beautiful!</strong> morning",
100 highlight("This is a beautiful! morning", "beautiful!")
101 )
102
103 assert_equal(
104 "This is a <strong class=\"highlight\">beautiful! morning</strong>",
105 highlight("This is a beautiful! morning", "beautiful! morning")
106 )
107
108 assert_equal(
109 "This is a <strong class=\"highlight\">beautiful? morning</strong>",
110 highlight("This is a beautiful? morning", "beautiful? morning")
111 )
112 end
113
114 def test_highlight_with_multiple_phrases_in_one_pass
115 assert_equal %(<em>wow</em> <em>em</em>), highlight('wow em', %w(wow em), '<em>\1</em>')
116 end
117
118 def test_highlight_with_options_hash
119 assert_equal(
120 "This is a <b>beautiful</b> morning, but also a <b>beautiful</b> day",
121 highlight("This is a beautiful morning, but also a beautiful day", "beautiful", :highlighter => '<b>\1</b>')
122 )
123 end
124
125 def test_excerpt
126 assert_equal("...is a beautiful morn...", excerpt("This is a beautiful morning", "beautiful", 5))
127 assert_equal("This is a...", excerpt("This is a beautiful morning", "this", 5))
128 assert_equal("...iful morning", excerpt("This is a beautiful morning", "morning", 5))
129 assert_nil excerpt("This is a beautiful morning", "day")
130 end
131
132 def test_excerpt_in_borderline_cases
133 assert_equal("", excerpt("", "", 0))
134 assert_equal("a", excerpt("a", "a", 0))
135 assert_equal("...b...", excerpt("abc", "b", 0))
136 assert_equal("abc", excerpt("abc", "b", 1))
137 assert_equal("abc...", excerpt("abcd", "b", 1))
138 assert_equal("...abc", excerpt("zabc", "b", 1))
139 assert_equal("...abc...", excerpt("zabcd", "b", 1))
140 assert_equal("zabcd", excerpt("zabcd", "b", 2))
141
142 # excerpt strips the resulting string before ap-/prepending excerpt_string.
143 # whether this behavior is meaningful when excerpt_string is not to be
144 # appended is questionable.
145 assert_equal("zabcd", excerpt(" zabcd ", "b", 4))
146 assert_equal("...abc...", excerpt("z abc d", "b", 1))
147 end
148
149 def test_excerpt_with_regex
150 assert_equal('...is a beautiful! mor...', excerpt('This is a beautiful! morning', 'beautiful', 5))
151 assert_equal('...is a beautiful? mor...', excerpt('This is a beautiful? morning', 'beautiful', 5))
152 end
153
154 def test_excerpt_with_options_hash
155 assert_equal("...is a beautiful morn...", excerpt("This is a beautiful morning", "beautiful", :radius => 5))
156 assert_equal("[...]is a beautiful morn[...]", excerpt("This is a beautiful morning", "beautiful", :omission => "[...]",:radius => 5))
157 assert_equal(
158 "This is the ultimate supercalifragilisticexpialidoceous very looooooooooooooooooong looooooooooooong beautiful morning with amazing sunshine and awesome tempera[...]",
159 excerpt("This is the ultimate supercalifragilisticexpialidoceous very looooooooooooooooooong looooooooooooong beautiful morning with amazing sunshine and awesome temperatures. So what are you gonna do about it?", "very",
160 :omission => "[...]")
161 )
162 end
163
164 if RUBY_VERSION < '1.9'
165 def test_excerpt_with_utf8
166 with_kcode('u') do
167 assert_equal("...\357\254\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
168 end
169 with_kcode('none') do
170 assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
171 end
172 end
173 else
174 def test_excerpt_with_utf8
175 assert_equal("...\357\254\203ciency could not be...".force_encoding('UTF-8'), excerpt("That's why e\357\254\203ciency could not be helped".force_encoding('UTF-8'), 'could', 8))
176 assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))
177 end
178 end
179
180 def test_word_wrap
181 assert_equal("my very very\nvery long\nstring", word_wrap("my very very very long string", 15))
182 end
183
184 def test_word_wrap_with_extra_newlines
185 assert_equal("my very very\nvery long\nstring\n\nwith another\nline", word_wrap("my very very very long string\n\nwith another line", 15))
186 end
187
188 def test_word_wrap_with_options_hash
189 assert_equal("my very very\nvery long\nstring", word_wrap("my very very very long string", :line_width => 15))
190 end
191
192 def test_pluralization
193 assert_equal("1 count", pluralize(1, "count"))
194 assert_equal("2 counts", pluralize(2, "count"))
195 assert_equal("1 count", pluralize('1', "count"))
196 assert_equal("2 counts", pluralize('2', "count"))
197 assert_equal("1,066 counts", pluralize('1,066', "count"))
198 assert_equal("1.25 counts", pluralize('1.25', "count"))
199 assert_equal("2 counters", pluralize(2, "count", "counters"))
200 assert_equal("0 counters", pluralize(nil, "count", "counters"))
201 assert_equal("2 people", pluralize(2, "person"))
202 assert_equal("10 buffaloes", pluralize(10, "buffalo"))
203 assert_equal("1 berry", pluralize(1, "berry"))
204 assert_equal("12 berries", pluralize(12, "berry"))
205 end
206
207 def test_auto_link_parsing
208 urls = %w(http://www.rubyonrails.com
209 http://www.rubyonrails.com:80
210 http://www.rubyonrails.com/~minam
211 https://www.rubyonrails.com/~minam
212 http://www.rubyonrails.com/~minam/url%20with%20spaces
213 http://www.rubyonrails.com/foo.cgi?something=here
214 http://www.rubyonrails.com/foo.cgi?something=here&and=here
215 http://www.rubyonrails.com/contact;new
216 http://www.rubyonrails.com/contact;new%20with%20spaces
217 http://www.rubyonrails.com/contact;new?with=query&string=params
218 http://www.rubyonrails.com/~minam/contact;new?with=query&string=params
219 http://en.wikipedia.org/wiki/Wikipedia:Today%27s_featured_picture_%28animation%29/January_20%2C_2007
220 http://www.mail-archive.com/rails@lists.rubyonrails.org/
221 http://www.amazon.com/Testing-Equal-Sign-In-Path/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1198861734&sr=8-1
222 http://en.wikipedia.org/wiki/Sprite_(computer_graphics)
223 http://en.wikipedia.org/wiki/Texas_hold'em
224 https://www.google.com/doku.php?id=gps:resource:scs:start
225 )
226
227 urls.each do |url|
228 assert_equal %(<a href="#{url}">#{url}</a>), auto_link(url)
229 end
230 end
231
232 def test_auto_linking
233 email_raw = 'david@loudthinking.com'
234 email_result = %{<a href="mailto:#{email_raw}">#{email_raw}</a>}
235 email2_raw = '+david@loudthinking.com'
236 email2_result = %{<a href="mailto:#{email2_raw}">#{email2_raw}</a>}
237 link_raw = 'http://www.rubyonrails.com'
238 link_result = %{<a href="#{link_raw}">#{link_raw}</a>}
239 link_result_with_options = %{<a href="#{link_raw}" target="_blank">#{link_raw}</a>}
240 link2_raw = 'www.rubyonrails.com'
241 link2_result = %{<a href="http://#{link2_raw}">#{link2_raw}</a>}
242 link3_raw = 'http://manuals.ruby-on-rails.com/read/chapter.need_a-period/103#page281'
243 link3_result = %{<a href="#{link3_raw}">#{link3_raw}</a>}
244 link4_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor123'
245 link4_result = %{<a href="#{link4_raw}">#{link4_raw}</a>}
246 link5_raw = 'http://foo.example.com:3000/controller/action'
247 link5_result = %{<a href="#{link5_raw}">#{link5_raw}</a>}
248 link6_raw = 'http://foo.example.com:3000/controller/action+pack'
249 link6_result = %{<a href="#{link6_raw}">#{link6_raw}</a>}
250 link7_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor-123'
251 link7_result = %{<a href="#{link7_raw}">#{link7_raw}</a>}
252 link8_raw = 'http://foo.example.com:3000/controller/action.html'
253 link8_result = %{<a href="#{link8_raw}">#{link8_raw}</a>}
254 link9_raw = 'http://business.timesonline.co.uk/article/0,,9065-2473189,00.html'
255 link9_result = %{<a href="#{link9_raw}">#{link9_raw}</a>}
256 link10_raw = 'http://www.mail-archive.com/ruby-talk@ruby-lang.org/'
257 link10_result = %{<a href="#{link10_raw}">#{link10_raw}</a>}
258
259 assert_equal %(hello #{email_result}), auto_link("hello #{email_raw}", :email_addresses)
260 assert_equal %(Go to #{link_result}), auto_link("Go to #{link_raw}", :urls)
261 assert_equal %(Go to #{link_raw}), auto_link("Go to #{link_raw}", :email_addresses)
262 assert_equal %(Go to #{link_result} and say hello to #{email_result}), auto_link("Go to #{link_raw} and say hello to #{email_raw}")
263 assert_equal %(<p>Link #{link_result}</p>), auto_link("<p>Link #{link_raw}</p>")
264 assert_equal %(<p>#{link_result} Link</p>), auto_link("<p>#{link_raw} Link</p>")
265 assert_equal %(<p>Link #{link_result_with_options}</p>), auto_link("<p>Link #{link_raw}</p>", :all, {:target => "_blank"})
266 assert_equal %(Go to #{link_result}.), auto_link(%(Go to #{link_raw}.))
267 assert_equal %(<p>Go to #{link_result}, then say hello to #{email_result}.</p>), auto_link(%(<p>Go to #{link_raw}, then say hello to #{email_raw}.</p>))
268 assert_equal %(Go to #{link2_result}), auto_link("Go to #{link2_raw}", :urls)
269 assert_equal %(Go to #{link2_raw}), auto_link("Go to #{link2_raw}", :email_addresses)
270 assert_equal %(<p>Link #{link2_result}</p>), auto_link("<p>Link #{link2_raw}</p>")
271 assert_equal %(<p>#{link2_result} Link</p>), auto_link("<p>#{link2_raw} Link</p>")
272 assert_equal %(Go to #{link2_result}.), auto_link(%(Go to #{link2_raw}.))
273 assert_equal %(<p>Say hello to #{email_result}, then go to #{link2_result}.</p>), auto_link(%(<p>Say hello to #{email_raw}, then go to #{link2_raw}.</p>))
274 assert_equal %(Go to #{link3_result}), auto_link("Go to #{link3_raw}", :urls)
275 assert_equal %(Go to #{link3_raw}), auto_link("Go to #{link3_raw}", :email_addresses)
276 assert_equal %(<p>Link #{link3_result}</p>), auto_link("<p>Link #{link3_raw}</p>")
277 assert_equal %(<p>#{link3_result} Link</p>), auto_link("<p>#{link3_raw} Link</p>")
278 assert_equal %(Go to #{link3_result}.), auto_link(%(Go to #{link3_raw}.))
279 assert_equal %(<p>Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.</p>))
280 assert_equal %(<p>Link #{link4_result}</p>), auto_link("<p>Link #{link4_raw}</p>")
281 assert_equal %(<p>#{link4_result} Link</p>), auto_link("<p>#{link4_raw} Link</p>")
282 assert_equal %(<p>#{link5_result} Link</p>), auto_link("<p>#{link5_raw} Link</p>")
283 assert_equal %(<p>#{link6_result} Link</p>), auto_link("<p>#{link6_raw} Link</p>")
284 assert_equal %(<p>#{link7_result} Link</p>), auto_link("<p>#{link7_raw} Link</p>")
285 assert_equal %(Go to #{link8_result}), auto_link("Go to #{link8_raw}", :urls)
286 assert_equal %(Go to #{link8_raw}), auto_link("Go to #{link8_raw}", :email_addresses)
287 assert_equal %(<p>Link #{link8_result}</p>), auto_link("<p>Link #{link8_raw}</p>")
288 assert_equal %(<p>#{link8_result} Link</p>), auto_link("<p>#{link8_raw} Link</p>")
289 assert_equal %(Go to #{link8_result}.), auto_link(%(Go to #{link8_raw}.))
290 assert_equal %(<p>Go to #{link8_result}. seriously, #{link8_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link8_raw}. seriously, #{link8_raw}? i think I'll say hello to #{email_raw}. instead.</p>))
291 assert_equal %(Go to #{link9_result}), auto_link("Go to #{link9_raw}", :urls)
292 assert_equal %(Go to #{link9_raw}), auto_link("Go to #{link9_raw}", :email_addresses)
293 assert_equal %(<p>Link #{link9_result}</p>), auto_link("<p>Link #{link9_raw}</p>")
294 assert_equal %(<p>#{link9_result} Link</p>), auto_link("<p>#{link9_raw} Link</p>")
295 assert_equal %(Go to #{link9_result}.), auto_link(%(Go to #{link9_raw}.))
296 assert_equal %(<p>Go to #{link9_result}. seriously, #{link9_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link9_raw}. seriously, #{link9_raw}? i think I'll say hello to #{email_raw}. instead.</p>))
297 assert_equal %(<p>#{link10_result} Link</p>), auto_link("<p>#{link10_raw} Link</p>")
298 assert_equal email2_result, auto_link(email2_raw)
299 assert_equal '', auto_link(nil)
300 assert_equal '', auto_link('')
301 assert_equal "#{link_result} #{link_result} #{link_result}", auto_link("#{link_raw} #{link_raw} #{link_raw}")
302 assert_equal '<a href="http://www.rubyonrails.com">Ruby On Rails</a>', auto_link('<a href="http://www.rubyonrails.com">Ruby On Rails</a>')
303 end
304
305 def test_auto_link_at_eol
306 url1 = "http://api.rubyonrails.com/Foo.html"
307 url2 = "http://www.ruby-doc.org/core/Bar.html"
308
309 assert_equal %(<p><a href="#{url1}">#{url1}</a><br /><a href="#{url2}">#{url2}</a><br /></p>), auto_link("<p>#{url1}<br />#{url2}<br /></p>")
310 end
311
312 def test_auto_link_with_block
313 url = "http://api.rubyonrails.com/Foo.html"
314 email = "fantabulous@shiznadel.ic"
315
316 assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |url| truncate(url, :length => 10) }
317 end
318
319 def test_auto_link_with_options_hash
320 assert_equal 'Welcome to my new blog at <a href="http://www.myblog.com/" class="menu" target="_blank">http://www.myblog.com/</a>. Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.',
321 auto_link("Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com.",
322 :link => :all, :html => { :class => "menu", :target => "_blank" })
323 end
324
325 def test_cycle_class
326 value = Cycle.new("one", 2, "3")
327 assert_equal("one", value.to_s)
328 assert_equal("2", value.to_s)
329 assert_equal("3", value.to_s)
330 assert_equal("one", value.to_s)
331 value.reset
332 assert_equal("one", value.to_s)
333 assert_equal("2", value.to_s)
334 assert_equal("3", value.to_s)
335 end
336
337 def test_cycle_class_with_no_arguments
338 assert_raise(ArgumentError) { value = Cycle.new() }
339 end
340
341 def test_cycle
342 assert_equal("one", cycle("one", 2, "3"))
343 assert_equal("2", cycle("one", 2, "3"))
344 assert_equal("3", cycle("one", 2, "3"))
345 assert_equal("one", cycle("one", 2, "3"))
346 assert_equal("2", cycle("one", 2, "3"))
347 assert_equal("3", cycle("one", 2, "3"))
348 end
349
350 def test_cycle_with_no_arguments
351 assert_raise(ArgumentError) { value = cycle() }
352 end
353
354 def test_cycle_resets_with_new_values
355 assert_equal("even", cycle("even", "odd"))
356 assert_equal("odd", cycle("even", "odd"))
357 assert_equal("even", cycle("even", "odd"))
358 assert_equal("1", cycle(1, 2, 3))
359 assert_equal("2", cycle(1, 2, 3))
360 assert_equal("3", cycle(1, 2, 3))
361 assert_equal("1", cycle(1, 2, 3))
362 end
363
364 def test_named_cycles
365 assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
366 assert_equal("red", cycle("red", "blue", :name => "colors"))
367 assert_equal("2", cycle(1, 2, 3, :name => "numbers"))
368 assert_equal("blue", cycle("red", "blue", :name => "colors"))
369 assert_equal("3", cycle(1, 2, 3, :name => "numbers"))
370 assert_equal("red", cycle("red", "blue", :name => "colors"))
371 end
372
373 def test_current_cycle_with_default_name
374 cycle("even","odd")
375 assert_equal "even", current_cycle
376 cycle("even","odd")
377 assert_equal "odd", current_cycle
378 cycle("even","odd")
379 assert_equal "even", current_cycle
380 end
381
382 def test_current_cycle_with_named_cycles
383 cycle("red", "blue", :name => "colors")
384 assert_equal "red", current_cycle("colors")
385 cycle("red", "blue", :name => "colors")
386 assert_equal "blue", current_cycle("colors")
387 cycle("red", "blue", :name => "colors")
388 assert_equal "red", current_cycle("colors")
389 end
390
391 def test_current_cycle_safe_call
392 assert_nothing_raised { current_cycle }
393 assert_nothing_raised { current_cycle("colors") }
394 end
395
396 def test_current_cycle_with_more_than_two_names
397 cycle(1,2,3)
398 assert_equal "1", current_cycle
399 cycle(1,2,3)
400 assert_equal "2", current_cycle
401 cycle(1,2,3)
402 assert_equal "3", current_cycle
403 cycle(1,2,3)
404 assert_equal "1", current_cycle
405 end
406
407 def test_default_named_cycle
408 assert_equal("1", cycle(1, 2, 3))
409 assert_equal("2", cycle(1, 2, 3, :name => "default"))
410 assert_equal("3", cycle(1, 2, 3))
411 end
412
413 def test_reset_cycle
414 assert_equal("1", cycle(1, 2, 3))
415 assert_equal("2", cycle(1, 2, 3))
416 reset_cycle
417 assert_equal("1", cycle(1, 2, 3))
418 end
419
420 def test_reset_unknown_cycle
421 reset_cycle("colors")
422 end
423
424 def test_recet_named_cycle
425 assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
426 assert_equal("red", cycle("red", "blue", :name => "colors"))
427 reset_cycle("numbers")
428 assert_equal("1", cycle(1, 2, 3, :name => "numbers"))
429 assert_equal("blue", cycle("red", "blue", :name => "colors"))
430 assert_equal("2", cycle(1, 2, 3, :name => "numbers"))
431 assert_equal("red", cycle("red", "blue", :name => "colors"))
432 end
433
434 def test_cycle_no_instance_variable_clashes
435 @cycles = %w{Specialized Fuji Giant}
436 assert_equal("red", cycle("red", "blue"))
437 assert_equal("blue", cycle("red", "blue"))
438 assert_equal("red", cycle("red", "blue"))
439 assert_equal(%w{Specialized Fuji Giant}, @cycles)
440 end
441 end