diff options
Diffstat (limited to 'spec/helpers/time_zone_helper_spec.rb')
-rw-r--r-- | spec/helpers/time_zone_helper_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/helpers/time_zone_helper_spec.rb b/spec/helpers/time_zone_helper_spec.rb index e6cb20b5800..43ad130c4b5 100644 --- a/spec/helpers/time_zone_helper_spec.rb +++ b/spec/helpers/time_zone_helper_spec.rb @@ -76,6 +76,18 @@ RSpec.describe TimeZoneHelper, :aggregate_failures do travel_to Time.find_zone(timezone).local(2021, 7, 20, 15, 30, 45) end + context 'when timezone is `nil`' do + it 'returns `nil`' do + expect(helper.local_time(nil)).to eq(nil) + end + end + + context 'when timezone is blank' do + it 'returns `nil`' do + expect(helper.local_time('')).to eq(nil) + end + end + context 'when a valid timezone is passed' do it 'returns local time' do expect(helper.local_time(timezone)).to eq('3:30 PM') |