From fe751cbfb7fca8310326104286f4ccf32b4ab2f1 Mon Sep 17 00:00:00 2001 From: ohbarye Date: Sun, 9 Oct 2022 22:15:14 +0900 Subject: [PATCH] Add specs: `Time.at` raises ArgumentError if `in` keyword format is invalid --- core/time/at_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/time/at_spec.rb b/core/time/at_spec.rb index 2cc46ab8c9..74b1962a95 100644 --- a/core/time/at_spec.rb +++ b/core/time/at_spec.rb @@ -266,5 +266,10 @@ time.zone.should == zone time.to_i.should == @epoch_time end + + it "raises ArgumentError if format is invalid" do + -> { Time.at(@epoch_time, in: "+09:99") }.should raise_error(ArgumentError) + -> { Time.at(@epoch_time, in: "ABC") }.should raise_error(ArgumentError) + end end end