summaryrefslogtreecommitdiff
path: root/spec/ruby/library/datetime
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-07-27 12:40:09 +0200
commit5c276e1cc91c5ab2a41fbf7827af2fed914a2bc0 (patch)
tree05b5c68c8b2a00224d4646ea3b26ce3877efaadd /spec/ruby/library/datetime
parenta06301b103371b0b7da8eaca26ba744961769f99 (diff)
Update to ruby/spec@875a09e
Diffstat (limited to 'spec/ruby/library/datetime')
-rw-r--r--spec/ruby/library/datetime/hour_spec.rb12
-rw-r--r--spec/ruby/library/datetime/new_spec.rb2
-rw-r--r--spec/ruby/library/datetime/parse_spec.rb12
-rw-r--r--spec/ruby/library/datetime/shared/min.rb12
-rw-r--r--spec/ruby/library/datetime/shared/sec.rb8
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb8
6 files changed, 27 insertions, 27 deletions
diff --git a/spec/ruby/library/datetime/hour_spec.rb b/spec/ruby/library/datetime/hour_spec.rb
index f019b60..8efd5f9 100644
--- a/spec/ruby/library/datetime/hour_spec.rb
+++ b/spec/ruby/library/datetime/hour_spec.rb
@@ -15,27 +15,27 @@ describe "DateTime#hour" do
end
it "raises an error for Rational" do
- lambda { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error for Float" do
- lambda { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 1.5).hour }.should raise_error(ArgumentError)
end
it "raises an error for Rational" do
- lambda { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(day: 1 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the hour is smaller than -24" do
- lambda { new_datetime(hour: -25) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: -25) }.should raise_error(ArgumentError)
end
it "raises an error, when the hour is larger than 24" do
- lambda { new_datetime(hour: 25) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 25) }.should raise_error(ArgumentError)
end
it "raises an error for hour fractions smaller than -24" do
- lambda { new_datetime(hour: -24 - Rational(1,2)) }.should(
+ -> { new_datetime(hour: -24 - Rational(1,2)) }.should(
raise_error(ArgumentError))
end
diff --git a/spec/ruby/library/datetime/new_spec.rb b/spec/ruby/library/datetime/new_spec.rb
index 85fbe75..6a4dced 100644
--- a/spec/ruby/library/datetime/new_spec.rb
+++ b/spec/ruby/library/datetime/new_spec.rb
@@ -47,6 +47,6 @@ describe "DateTime.new" do
end
it "raises an error on invalid arguments" do
- lambda { new_datetime(minute: 999) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 999) }.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/datetime/parse_spec.rb b/spec/ruby/library/datetime/parse_spec.rb
index e5441bd..e9bf4e2 100644
--- a/spec/ruby/library/datetime/parse_spec.rb
+++ b/spec/ruby/library/datetime/parse_spec.rb
@@ -20,7 +20,7 @@ describe "DateTime.parse" do
# Specs using numbers
it "throws an argument error for a single digit" do
- lambda{ DateTime.parse("1") }.should raise_error(ArgumentError)
+ ->{ DateTime.parse("1") }.should raise_error(ArgumentError)
end
it "parses DD as month day number" do
@@ -54,23 +54,23 @@ describe "DateTime.parse" do
end
it "throws an argument error for invalid month values" do
- lambda{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid day values" do
- lambda{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid hour values" do
- lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid minute values" do
- lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
end
it "throws an argument error for invalid second values" do
- lambda{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError)
+ ->{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError)
end
end
diff --git a/spec/ruby/library/datetime/shared/min.rb b/spec/ruby/library/datetime/shared/min.rb
index e69d86a..a35b839 100644
--- a/spec/ruby/library/datetime/shared/min.rb
+++ b/spec/ruby/library/datetime/shared/min.rb
@@ -14,27 +14,27 @@ describe :datetime_min, shared: true do
end
it "raises an error for Rational" do
- lambda { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError)
+ -> { new_datetime minute: 5 + Rational(1,2) }.should raise_error(ArgumentError)
end
it "raises an error for Float" do
- lambda { new_datetime minute: 5.5 }.should raise_error(ArgumentError)
+ -> { new_datetime minute: 5.5 }.should raise_error(ArgumentError)
end
it "raises an error for Rational" do
- lambda { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(hour: 2 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the minute is smaller than -60" do
- lambda { new_datetime(minute: -61) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: -61) }.should raise_error(ArgumentError)
end
it "raises an error, when the minute is greater or equal than 60" do
- lambda { new_datetime(minute: 60) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 60) }.should raise_error(ArgumentError)
end
it "raises an error for minute fractions smaller than -60" do
- lambda { new_datetime(minute: -60 - Rational(1,2))}.should(
+ -> { new_datetime(minute: -60 - Rational(1,2))}.should(
raise_error(ArgumentError))
end
end
diff --git a/spec/ruby/library/datetime/shared/sec.rb b/spec/ruby/library/datetime/shared/sec.rb
index 68e8af8..6000921 100644
--- a/spec/ruby/library/datetime/shared/sec.rb
+++ b/spec/ruby/library/datetime/shared/sec.rb
@@ -23,19 +23,19 @@ describe :datetime_sec, shared: true do
end
it "raises an error when minute is given as a rational" do
- lambda { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError)
+ -> { new_datetime(minute: 5 + Rational(1,2)) }.should raise_error(ArgumentError)
end
it "raises an error, when the second is smaller than -60" do
- lambda { new_datetime(second: -61) }.should raise_error(ArgumentError)
+ -> { new_datetime(second: -61) }.should raise_error(ArgumentError)
end
it "raises an error, when the second is greater or equal than 60" do
- lambda { new_datetime(second: 60) }.should raise_error(ArgumentError)
+ -> { new_datetime(second: 60) }.should raise_error(ArgumentError)
end
it "raises an error for second fractions smaller than -60" do
- lambda { new_datetime(second: -60 - Rational(1,2))}.should(
+ -> { new_datetime(second: -60 - Rational(1,2))}.should(
raise_error(ArgumentError))
end
diff --git a/spec/ruby/library/datetime/strftime_spec.rb b/spec/ruby/library/datetime/strftime_spec.rb
index f95b52f..1c925f9 100644
--- a/spec/ruby/library/datetime/strftime_spec.rb
+++ b/spec/ruby/library/datetime/strftime_spec.rb
@@ -4,13 +4,13 @@ require_relative '../../shared/time/strftime_for_time'
describe "DateTime#strftime" do
before :all do
- @new_date = lambda { |y,m,d| DateTime.civil(y,m,d) }
- @new_time = lambda { |*args| DateTime.civil(*args) }
- @new_time_in_zone = lambda { |zone,offset,*args|
+ @new_date = -> y, m, d { DateTime.civil(y,m,d) }
+ @new_time = -> *args { DateTime.civil(*args) }
+ @new_time_in_zone = -> zone, offset, *args {
y, m, d, h, min, s = args
DateTime.new(y, m||1, d||1, h||0, min||0, s||0, Rational(offset, 24))
}
- @new_time_with_offset = lambda { |y,m,d,h,min,s,offset|
+ @new_time_with_offset = -> y, m, d, h, min, s, offset {
DateTime.new(y,m,d,h,min,s, Rational(offset, 86_400))
}