diff options
author | rick <rick@spacemonkey.local> | 2008-05-10 17:46:55 -0700 |
---|---|---|
committer | rick <rick@spacemonkey.local> | 2008-05-10 17:46:55 -0700 |
commit | d09a8446d5606a5a0b5c024224b09a1318e9cf4d (patch) | |
tree | 199ef3554f731c980ea5726e67e34af4ea057c2e /actionpack/test/template/date_helper_test.rb | |
parent | c8451aeeea200043d8a3e6eae9c49def3a154ddb (diff) | |
parent | a7ea06b4ebe252e258f83e7de945b4baa30ec3bc (diff) | |
download | rails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.tar.gz rails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.tar.bz2 rails-d09a8446d5606a5a0b5c024224b09a1318e9cf4d.zip |
fix merge conflict with actionpack changelog
Diffstat (limited to 'actionpack/test/template/date_helper_test.rb')
-rwxr-xr-x | actionpack/test/template/date_helper_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index 2373600bfe..ae83c7bf47 100755 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -950,6 +950,15 @@ class DateHelperTest < ActionView::TestCase expects(:select_minute).with(time, anything, anything).returns('') select_time end + + def test_select_date_uses_date_current_as_default + date = stub(:year => 2004, :month => 6, :day => 15) + Date.expects(:current).returns date + expects(:select_year).with(date, anything, anything).returns('') + expects(:select_month).with(date, anything, anything).returns('') + expects(:select_day).with(date, anything, anything).returns('') + select_date + end end def test_date_select @@ -1699,4 +1708,27 @@ class DateHelperTest < ActionView::TestCase assert_dom_equal expected, datetime_select("post", "updated_at", {}, :class => 'selector') end + uses_mocha 'TestInstanceTagDefaultTimeFromOptions' do + def test_instance_tag_default_time_from_options_uses_time_current_as_default_when_hash_passed_as_arg + dummy_instance_tag = ActionView::Helpers::InstanceTag.new(1,2,3) + Time.expects(:current).returns Time.now + dummy_instance_tag.send!(:default_time_from_options, :hour => 2) + end + + def test_instance_tag_default_time_from_options_respects_hash_arg_settings_when_time_falls_in_system_local_dst_spring_gap + with_env_tz('US/Central') do + dummy_instance_tag = ActionView::Helpers::InstanceTag.new(1,2,3) + Time.stubs(:now).returns Time.local(2006, 4, 2, 1) + assert_equal 2, dummy_instance_tag.send!(:default_time_from_options, :hour => 2).hour + end + end + end + + protected + def with_env_tz(new_tz = 'US/Eastern') + old_tz, ENV['TZ'] = ENV['TZ'], new_tz + yield + ensure + old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') + end end |