Skip to content
This repository
Browse code

Fix date helper test when run on 31st day of the month! Closes #6907.…

… [mutru]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5826 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit a0b1ac2ef8a5a4d8ed8544aa56d2bc87968c6069 1 parent e03cd53
Jeremy Kemper authored January 01, 2007
14  actionpack/test/template/date_helper_test.rb
@@ -853,7 +853,7 @@ def test_date_select_with_different_order
853 853
     expected << "</select>\n"
854 854
 
855 855
     expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
856  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  856
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
857 857
     expected << "</select>\n"
858 858
 
859 859
     expected <<  %{<select id="post_written_on_1i" name="post[written_on(1i)]">\n}
@@ -873,7 +873,7 @@ def test_date_select_with_nil
873 873
     expected << "</select>\n"
874 874
 
875 875
     expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
876  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.month}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  876
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == Time.now.month}>#{Date::MONTHNAMES[i]}</option>\n) }
877 877
     expected << "</select>\n"
878 878
 
879 879
     expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
@@ -895,7 +895,7 @@ def test_date_select_with_nil_and_blank
895 895
 
896 896
     expected << %{<select id="post_written_on_2i" name="post[written_on(2i)]">\n}
897 897
     expected << "<option value=\"\"></option>\n"
898  
-    1.upto(12) { |i| expected << %(<option value="#{i}">#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  898
+    1.upto(12) { |i| expected << %(<option value="#{i}">#{Date::MONTHNAMES[i]}</option>\n) }
899 899
     expected << "</select>\n"
900 900
 
901 901
     expected << %{<select id="post_written_on_3i" name="post[written_on(3i)]">\n}
@@ -1178,7 +1178,7 @@ def test_datetime_select_with_seconds
1178 1178
     1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
1179 1179
     expected << "</select>\n"
1180 1180
     expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
1181  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  1181
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
1182 1182
     expected << "</select>\n"
1183 1183
     expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
1184 1184
     1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
@@ -1207,7 +1207,7 @@ def test_datetime_select_discard_year
1207 1207
 
1208 1208
     expected = %{<input type="hidden" id="post_updated_at_1i" name="post[updated_at(1i)]" value="2004" />\n}
1209 1209
     expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
1210  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  1210
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
1211 1211
     expected << "</select>\n"
1212 1212
     expected << %{<select id="post_updated_at_3i" name="post[updated_at(3i)]">\n}
1213 1213
     1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
@@ -1276,7 +1276,7 @@ def test_datetime_select_invalid_order
1276 1276
     1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
1277 1277
     expected << "</select>\n"
1278 1278
     expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
1279  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  1279
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
1280 1280
     expected << "</select>\n"
1281 1281
     expected << %{<select id="post_updated_at_1i" name="post[updated_at(1i)]">\n}
1282 1282
     1999.upto(2009) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 2004}>#{i}</option>\n) }
@@ -1304,7 +1304,7 @@ def test_datetime_select_discard_with_order
1304 1304
     1.upto(31) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 15}>#{i}</option>\n) }
1305 1305
     expected << "</select>\n"
1306 1306
     expected << %{<select id="post_updated_at_2i" name="post[updated_at(2i)]">\n}
1307  
-    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Time.now.change(:month => i).strftime("%B")}</option>\n) }
  1307
+    1.upto(12) { |i| expected << %(<option value="#{i}"#{' selected="selected"' if i == 6}>#{Date::MONTHNAMES[i]}</option>\n) }
1308 1308
     expected << "</select>\n"
1309 1309
 
1310 1310
     expected << " &mdash; "

0 notes on commit a0b1ac2

Please sign in to comment.
Something went wrong with that request. Please try again.