Permalink
Browse files

Add regression test for TZ grep

Added a regression test that will fail if anyone tries to change
time_zone_select to use grep again thinking it will work when it does
not.
  • Loading branch information...
1 parent 1cc991b commit 53d68bd964af17484898c5cd5e21a8ce9c359143 @bdmac bdmac committed Mar 27, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 actionpack/test/template/form_options_helper_test.rb
@@ -1110,6 +1110,26 @@ def test_time_zone_select_with_priority_zones_as_regexp
"</select>",
html
end
+
+ def test_time_zone_select_with_priority_zones_as_regexp_using_grep_finds_no_zones
+ @firm = Firm.new("D")
+
+ priority_zones = /A|D/
+ @fake_timezones.each_with_index do |tz, i|
+ priority_zones.stubs(:===).with(tz).raises(Exception)
+ end
+
+ html = time_zone_select("firm", "time_zone", priority_zones)
+ assert_dom_equal "<select id=\"firm_time_zone\" name=\"firm[time_zone]\">" +
+ "<option value=\"\" disabled=\"disabled\">-------------</option>\n" +
+ "<option value=\"A\">A</option>\n" +
+ "<option value=\"B\">B</option>\n" +
+ "<option value=\"C\">C</option>\n" +
+ "<option value=\"D\" selected=\"selected\">D</option>\n" +
+ "<option value=\"E\">E</option>" +
+ "</select>",
+ html
+ end
def test_time_zone_select_with_default_time_zone_and_nil_value
@firm = Firm.new()

0 comments on commit 53d68bd

Please sign in to comment.