Skip to content

Commit e80f0c1

Browse files
rwstaunereregon
authored andcommitted
Simplify regexp and out of range specs for Time.new(String)
1 parent 822b091 commit e80f0c1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/time/new_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -621,31 +621,31 @@ def obj.to_int; 3; end
621621
it "raises ArgumentError if date/time parts values are not valid" do
622622
-> {
623623
Time.new("2020-13-25 00:56:17 +09:00")
624-
}.should raise_error(ArgumentError, /mon out of range|can't parse:/)
624+
}.should raise_error(ArgumentError, /(mon|argument) out of range/)
625625

626626
-> {
627627
Time.new("2020-12-32 00:56:17 +09:00")
628-
}.should raise_error(ArgumentError, /mday out of range|can't parse:/)
628+
}.should raise_error(ArgumentError, /(mday|argument) out of range/)
629629

630630
-> {
631631
Time.new("2020-12-25 25:56:17 +09:00")
632-
}.should raise_error(ArgumentError, /hour out of range|can't parse:/)
632+
}.should raise_error(ArgumentError, /(hour|argument) out of range/)
633633

634634
-> {
635635
Time.new("2020-12-25 00:61:17 +09:00")
636-
}.should raise_error(ArgumentError, /min out of range|can't parse:/)
636+
}.should raise_error(ArgumentError, /(min|argument) out of range/)
637637

638638
-> {
639639
Time.new("2020-12-25 00:56:61 +09:00")
640-
}.should raise_error(ArgumentError, /sec out of range|can't parse:/)
640+
}.should raise_error(ArgumentError, /(sec|argument) out of range/)
641641

642642
-> {
643643
Time.new("2020-12-25 00:56:17 +23:59:60")
644-
}.should raise_error(ArgumentError, /utc_offset|can't parse:/)
644+
}.should raise_error(ArgumentError, /(utc_offset|argument) out of range/)
645645

646646
-> {
647647
Time.new("2020-12-25 00:56:17 +24:00")
648-
}.should raise_error(ArgumentError, /utc_offset|can't parse:/)
648+
}.should raise_error(ArgumentError, /(utc_offset|argument) out of range/)
649649

650650
-> {
651651
Time.new("2020-12-25 00:56:17 +23:61")

0 commit comments

Comments
 (0)