From c4b7ca06a4f80983a531b1e5094043be1e13f53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 24 Jan 2012 16:37:39 -0200 Subject: Fix date_select with discard_month and discard_year options Closes #4553 and #4633 --- actionpack/test/template/date_helper_test.rb | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'actionpack/test/template/date_helper_test.rb') diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index 3614d2e77d..b69c47b476 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -1601,6 +1601,43 @@ class DateHelperTest < ActionView::TestCase assert_dom_equal expected, date_select("post", "written_on", :order=>[:year, :month], :include_blank=>true) end + def test_date_select_with_nil_and_blank_and_discard_month + @post = Post.new + + start_year = Time.now.year-5 + end_year = Time.now.year+5 + + expected = %{\n" + expected << '' + "\n" + expected << '' + "\n" + + assert_dom_equal expected, date_select("post", "written_on", :discard_month => true, :include_blank=>true) + end + + def test_date_select_with_nil_and_blank_and_discard_year + @post = Post.new + + start_year = Time.now.year-5 + end_year = Time.now.year+5 + + expected = '' + "\n" + + expected << %{\n" + + expected << %{\n" + + assert_dom_equal expected, date_select("post", "written_on", :discard_year => true, :include_blank=>true) + end + def test_date_select_cant_override_discard_hour @post = Post.new @post.written_on = Date.new(2004, 6, 15) -- cgit v1.2.3