diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-08 11:48:38 -0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2010-01-08 11:49:12 -0800 |
commit | 188d52165bc9184a143a468ee951981d159dbea6 (patch) | |
tree | c956c450c3d39f1724c174eef490987b5c71d37d /actionpack/test | |
parent | 5ea130943eb27586272ecebb060ff1475cadbed6 (diff) | |
download | rails-188d52165bc9184a143a468ee951981d159dbea6.tar.gz rails-188d52165bc9184a143a468ee951981d159dbea6.tar.bz2 rails-188d52165bc9184a143a468ee951981d159dbea6.zip |
Fixed that much of DateHelper wouldn't return html_safe? strings [DHH]
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/date_helper_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index 9fb2080f77..fb51b67185 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -2475,6 +2475,28 @@ class DateHelperTest < ActionView::TestCase }, options) end + def test_select_html_safety + assert select_day(16).html_safe? + assert select_month(8).html_safe? + assert select_year(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe? + assert select_minute(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe? + assert select_second(Time.mktime(2003, 8, 16, 8, 4, 18)).html_safe? + + assert select_minute(8, :use_hidden => true).html_safe? + assert select_month(8, :prompt => 'Choose month').html_safe? + + assert select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector').html_safe? + assert select_date(Time.mktime(2003, 8, 16), :date_separator => " / ", :start_year => 2003, :end_year => 2005, :prefix => "date[first]").html_safe? + end + + def test_object_select_html_safety + @post = Post.new + @post.written_on = Date.new(2004, 6, 15) + + assert date_select("post", "written_on", :default => Time.local(2006, 9, 19, 15, 16, 35), :include_blank => true).html_safe? + assert time_select("post", "written_on", :ignore_date => true).html_safe? + end + protected def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz |