summaryrefslogtreecommitdiff
path: root/spec/ruby/core/time/new_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/time/new_spec.rb')
-rw-r--r--spec/ruby/core/time/new_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/time/new_spec.rb b/spec/ruby/core/time/new_spec.rb
index dcdd83a085..01ee47faa1 100644
--- a/spec/ruby/core/time/new_spec.rb
+++ b/spec/ruby/core/time/new_spec.rb
@@ -113,6 +113,12 @@ describe "Time.new with a utc_offset argument" do
it "raises ArgumentError if the utc_offset argument is greater than or equal to 10e9" do
-> { Time.new(2000, 1, 1, 0, 0, 0, 1000000000) }.should raise_error(ArgumentError)
end
+
+ it "raises ArgumentError if the month is greater than 12" do
+ # For some reason MRI uses a different message for month in 13-15 and month>=16
+ -> { Time.new(2000, 13, 1, 0, 0, 0, "+01:00") }.should raise_error(ArgumentError, /(mon|argument) out of range/)
+ -> { Time.new(2000, 16, 1, 0, 0, 0, "+01:00") }.should raise_error(ArgumentError, "argument out of range")
+ end
end
ruby_version_is "2.6" do