diff options
Diffstat (limited to 'spec/ruby/library/date')
-rw-r--r-- | spec/ruby/library/date/add_month_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/date/add_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/date/constants_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/library/date/iso8601_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/library/date/minus_month_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/library/date/minus_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/library/date/parse_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/library/date/plus_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/library/date/shared/civil.rb | 16 | ||||
-rw-r--r-- | spec/ruby/library/date/shared/commercial.rb | 18 | ||||
-rw-r--r-- | spec/ruby/library/date/strftime_spec.rb | 2 |
11 files changed, 41 insertions, 41 deletions
diff --git a/spec/ruby/library/date/add_month_spec.rb b/spec/ruby/library/date/add_month_spec.rb index 32e9de4d70..40833f6487 100644 --- a/spec/ruby/library/date/add_month_spec.rb +++ b/spec/ruby/library/date/add_month_spec.rb @@ -21,18 +21,18 @@ describe "Date#>>" do end it "raise a TypeError when passed a Symbol" do - lambda { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError) end it "raise a TypeError when passed a String" do - lambda { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError) end it "raise a TypeError when passed a Date" do - lambda { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError) end it "raise a TypeError when passed an Object" do - lambda { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/add_spec.rb b/spec/ruby/library/date/add_spec.rb index edcff4c55b..2b9cc62023 100644 --- a/spec/ruby/library/date/add_spec.rb +++ b/spec/ruby/library/date/add_spec.rb @@ -13,18 +13,18 @@ describe "Date#+" do end it "raises a TypeError when passed a Symbol" do - lambda { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError) end it "raises a TypeError when passed a String" do - lambda { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError) end it "raises a TypeError when passed a Date" do - lambda { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError) end it "raises a TypeError when passed an Object" do - lambda { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb index dd7803052f..fc1dba4999 100644 --- a/spec/ruby/library/date/constants_spec.rb +++ b/spec/ruby/library/date/constants_spec.rb @@ -34,11 +34,11 @@ describe "Date constants" do it "freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" do [Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary| - lambda { + -> { ary << "Unknown" }.should raise_error(frozen_error_class, /frozen/) ary.compact.each do |name| - lambda { + -> { name << "modified" }.should raise_error(frozen_error_class, /frozen/) end diff --git a/spec/ruby/library/date/iso8601_spec.rb b/spec/ruby/library/date/iso8601_spec.rb index 41f055e648..21b0a4cedd 100644 --- a/spec/ruby/library/date/iso8601_spec.rb +++ b/spec/ruby/library/date/iso8601_spec.rb @@ -28,10 +28,10 @@ describe "Date.iso8601" do end it "raises an ArgumentError when passed a Symbol without a valid Date" do - lambda { Date.iso8601(:test) }.should raise_error(ArgumentError) + -> { Date.iso8601(:test) }.should raise_error(ArgumentError) end it "raises a TypeError when passed an Object" do - lambda { Date.iso8601(Object.new) }.should raise_error(TypeError) + -> { Date.iso8601(Object.new) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/minus_month_spec.rb b/spec/ruby/library/date/minus_month_spec.rb index 563da073f0..470c4d8a76 100644 --- a/spec/ruby/library/date/minus_month_spec.rb +++ b/spec/ruby/library/date/minus_month_spec.rb @@ -14,10 +14,10 @@ describe "Date#<<" do end it "raises an error on non numeric parameters" do - lambda { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) << Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/minus_spec.rb b/spec/ruby/library/date/minus_spec.rb index 4cf6129f02..5a2a29e04a 100644 --- a/spec/ruby/library/date/minus_spec.rb +++ b/spec/ruby/library/date/minus_spec.rb @@ -22,9 +22,9 @@ describe "Date#-" do end it "raises an error for non Numeric arguments" do - lambda { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError) - lambda { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) - Object.new }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/parse_spec.rb b/spec/ruby/library/date/parse_spec.rb index 09e072ba3e..379847a6fd 100644 --- a/spec/ruby/library/date/parse_spec.rb +++ b/spec/ruby/library/date/parse_spec.rb @@ -23,7 +23,7 @@ describe "Date#parse" do # Specs using numbers it "throws an argument error for a single digit" do - lambda{ Date.parse("1") }.should raise_error(ArgumentError) + ->{ Date.parse("1") }.should raise_error(ArgumentError) end it "parses DD as month day number" do @@ -66,8 +66,8 @@ describe "Date#parse" do end it "raises a TypeError trying to parse non-String-like object" do - lambda { Date.parse(1) }.should raise_error(TypeError) - lambda { Date.parse(:invalid) }.should raise_error(TypeError) + -> { Date.parse(1) }.should raise_error(TypeError) + -> { Date.parse(:invalid) }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/plus_spec.rb b/spec/ruby/library/date/plus_spec.rb index ce5e074ed7..0cb99fd4ca 100644 --- a/spec/ruby/library/date/plus_spec.rb +++ b/spec/ruby/library/date/plus_spec.rb @@ -15,6 +15,6 @@ describe "Date#+" do end it "raises TypeError if argument is not Numeric" do - lambda { Date.today + Date.today }.should raise_error(TypeError) + -> { Date.today + Date.today }.should raise_error(TypeError) end end diff --git a/spec/ruby/library/date/shared/civil.rb b/spec/ruby/library/date/shared/civil.rb index 47dbed49fc..4c8ba23622 100644 --- a/spec/ruby/library/date/shared/civil.rb +++ b/spec/ruby/library/date/shared/civil.rb @@ -36,14 +36,14 @@ describe :date_civil, shared: true do end it "doesn't create dates for invalid arguments" do - lambda { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError) - - lambda { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2000, 13, 31) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 12, 32) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 2, 30) }.should raise_error(ArgumentError) + -> { Date.send(@method, 1900, 2, 29) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2000, 2, 29) }.should_not raise_error(ArgumentError) + + -> { Date.send(@method, 1582, 10, 14) }.should raise_error(ArgumentError) + -> { Date.send(@method, 1582, 10, 15) }.should_not raise_error(ArgumentError) end diff --git a/spec/ruby/library/date/shared/commercial.rb b/spec/ruby/library/date/shared/commercial.rb index 354a5d5cd0..39c9af47b6 100644 --- a/spec/ruby/library/date/shared/commercial.rb +++ b/spec/ruby/library/date/shared/commercial.rb @@ -25,15 +25,15 @@ describe :date_commercial, shared: true do end it "creates only Date objects for valid weeks" do - lambda { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 1) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 0) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 53, 8) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 54, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2004, 0, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError) - lambda { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 1) }.should_not raise_error(ArgumentError) + -> { Date.send(@method, 2003, 53, 1) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 0) }.should raise_error(ArgumentError) + -> { Date.send(@method, 2003, 52, 8) }.should raise_error(ArgumentError) end end diff --git a/spec/ruby/library/date/strftime_spec.rb b/spec/ruby/library/date/strftime_spec.rb index 973d4668f8..9d298e42e6 100644 --- a/spec/ruby/library/date/strftime_spec.rb +++ b/spec/ruby/library/date/strftime_spec.rb @@ -3,7 +3,7 @@ require_relative '../../shared/time/strftime_for_date' describe "Date#strftime" do before :all do - @new_date = lambda { |y,m,d| Date.civil(y,m,d) } + @new_date = -> y, m, d { Date.civil(y,m,d) } @date = Date.civil(2000, 4, 9) end |