aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorgbuesing <gbuesing@gmail.com>2008-04-21 00:40:04 -0500
committergbuesing <gbuesing@gmail.com>2008-04-21 00:40:04 -0500
commitf757f5838818ce35f7927a10a8cda6f9583869c5 (patch)
treedaf4e2170f579dd562eb930c6d94254670aa7401 /actionpack/test/template
parentc2c779044ffb1c435f4722f62fcbd400883f3225 (diff)
downloadrails-f757f5838818ce35f7927a10a8cda6f9583869c5.tar.gz
rails-f757f5838818ce35f7927a10a8cda6f9583869c5.tar.bz2
rails-f757f5838818ce35f7927a10a8cda6f9583869c5.zip
select_datetime and select_time default to Time.zone.now when config.time_zone is set
Diffstat (limited to 'actionpack/test/template')
-rwxr-xr-xactionpack/test/template/date_helper_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb
index fab41d801d..2373600bfe 100755
--- a/actionpack/test/template/date_helper_test.rb
+++ b/actionpack/test/template/date_helper_test.rb
@@ -933,6 +933,24 @@ class DateHelperTest < ActionView::TestCase
assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, :class => 'selector')
assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {:include_seconds => false}, :class => 'selector')
end
+
+ uses_mocha 'TestDatetimeAndTimeSelectUseTimeCurrentAsDefault' do
+ def test_select_datetime_uses_time_current_as_default
+ time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
+ Time.expects(:current).returns time
+ expects(:select_date).with(time, anything, anything).returns('')
+ expects(:select_time).with(time, anything, anything).returns('')
+ select_datetime
+ end
+
+ def test_select_time_uses_time_current_as_default
+ time = stub(:year => 2004, :month => 6, :day => 15, :hour => 16, :min => 35, :sec => 0)
+ Time.expects(:current).returns time
+ expects(:select_hour).with(time, anything, anything).returns('')
+ expects(:select_minute).with(time, anything, anything).returns('')
+ select_time
+ end
+ end
def test_date_select
@post = Post.new