diff options
Diffstat (limited to 'spec/ruby/library/date')
28 files changed, 134 insertions, 146 deletions
diff --git a/spec/ruby/library/date/add_month_spec.rb b/spec/ruby/library/date/add_month_spec.rb index 40833f6487..ab802ea97a 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 - -> { Date.civil(2007,2,27) >> :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> :hello }.should.raise(TypeError) end it "raise a TypeError when passed a String" do - -> { Date.civil(2007,2,27) >> "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> "hello" }.should.raise(TypeError) end it "raise a TypeError when passed a Date" do - -> { Date.civil(2007,2,27) >> Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Date.new }.should.raise(TypeError) end it "raise a TypeError when passed an Object" do - -> { Date.civil(2007,2,27) >> Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) >> Object.new }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/add_spec.rb b/spec/ruby/library/date/add_spec.rb index 2b9cc62023..5e368decdc 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 - -> { Date.civil(2007,2,27) + :hello }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + :hello }.should.raise(TypeError) end it "raises a TypeError when passed a String" do - -> { Date.civil(2007,2,27) + "hello" }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + "hello" }.should.raise(TypeError) end it "raises a TypeError when passed a Date" do - -> { Date.civil(2007,2,27) + Date.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Date.new }.should.raise(TypeError) end it "raises a TypeError when passed an Object" do - -> { Date.civil(2007,2,27) + Object.new }.should raise_error(TypeError) + -> { Date.civil(2007,2,27) + Object.new }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/constants_spec.rb b/spec/ruby/library/date/constants_spec.rb index 1d18dd1b0c..3494b0c296 100644 --- a/spec/ruby/library/date/constants_spec.rb +++ b/spec/ruby/library/date/constants_spec.rb @@ -36,11 +36,11 @@ describe "Date constants" do [Date::MONTHNAMES, Date::DAYNAMES, Date::ABBR_MONTHNAMES, Date::ABBR_DAYNAMES].each do |ary| -> { ary << "Unknown" - }.should raise_error(FrozenError, /frozen/) + }.should.raise(FrozenError, /frozen/) ary.compact.each do |name| -> { name << "modified" - }.should raise_error(FrozenError, /frozen/) + }.should.raise(FrozenError, /frozen/) end end end diff --git a/spec/ruby/library/date/deconstruct_keys_spec.rb b/spec/ruby/library/date/deconstruct_keys_spec.rb index 92579e35c7..1fa1e70250 100644 --- a/spec/ruby/library/date/deconstruct_keys_spec.rb +++ b/spec/ruby/library/date/deconstruct_keys_spec.rb @@ -2,43 +2,41 @@ require_relative '../../spec_helper' require 'date' date_version = defined?(Date::VERSION) ? Date::VERSION : '3.1.0' -version_is date_version, "3.3" do #ruby_version_is "3.2" do - describe "Date#deconstruct_keys" do - it "returns whole hash for nil as an argument" do - d = Date.new(2022, 10, 5) - d.deconstruct_keys(nil).should == { year: 2022, month: 10, day: 5, yday: 278, wday: 3 } - end - - it "returns only specified keys" do - d = Date.new(2022, 10, 5) - d.deconstruct_keys([:year, :month]).should == { year: 2022, month: 10 } - end - - it "requires one argument" do - -> { - Date.new(2022, 10, 5).deconstruct_keys - }.should raise_error(ArgumentError) - end - - it "it raises error when argument is neither nil nor array" do - d = Date.new(2022, 10, 5) - - -> { d.deconstruct_keys(1) }.should raise_error(TypeError, "wrong argument type Integer (expected Array or nil)") - -> { d.deconstruct_keys("asd") }.should raise_error(TypeError, "wrong argument type String (expected Array or nil)") - -> { d.deconstruct_keys(:x) }.should raise_error(TypeError, "wrong argument type Symbol (expected Array or nil)") - -> { d.deconstruct_keys({}) }.should raise_error(TypeError, "wrong argument type Hash (expected Array or nil)") - end - - it "returns {} when passed []" do - Date.new(2022, 10, 5).deconstruct_keys([]).should == {} - end - - it "ignores non-Symbol keys" do - Date.new(2022, 10, 5).deconstruct_keys(['year', []]).should == {} - end - - it "ignores not existing Symbol keys" do - Date.new(2022, 10, 5).deconstruct_keys([:year, :a]).should == { year: 2022 } - end +describe "Date#deconstruct_keys" do + it "returns whole hash for nil as an argument" do + d = Date.new(2022, 10, 5) + d.deconstruct_keys(nil).should == { year: 2022, month: 10, day: 5, yday: 278, wday: 3 } + end + + it "returns only specified keys" do + d = Date.new(2022, 10, 5) + d.deconstruct_keys([:year, :month]).should == { year: 2022, month: 10 } + end + + it "requires one argument" do + -> { + Date.new(2022, 10, 5).deconstruct_keys + }.should.raise(ArgumentError) + end + + it "it raises error when argument is neither nil nor array" do + d = Date.new(2022, 10, 5) + + -> { d.deconstruct_keys(1) }.should.raise(TypeError, "wrong argument type Integer (expected Array or nil)") + -> { d.deconstruct_keys("asd") }.should.raise(TypeError, "wrong argument type String (expected Array or nil)") + -> { d.deconstruct_keys(:x) }.should.raise(TypeError, "wrong argument type Symbol (expected Array or nil)") + -> { d.deconstruct_keys({}) }.should.raise(TypeError, "wrong argument type Hash (expected Array or nil)") + end + + it "returns {} when passed []" do + Date.new(2022, 10, 5).deconstruct_keys([]).should == {} + end + + it "ignores non-Symbol keys" do + Date.new(2022, 10, 5).deconstruct_keys(['year', []]).should == {} + end + + it "ignores not existing Symbol keys" do + Date.new(2022, 10, 5).deconstruct_keys([:year, :a]).should == { year: 2022 } end end diff --git a/spec/ruby/library/date/eql_spec.rb b/spec/ruby/library/date/eql_spec.rb index a1819cae3a..79fabc47f4 100644 --- a/spec/ruby/library/date/eql_spec.rb +++ b/spec/ruby/library/date/eql_spec.rb @@ -3,10 +3,10 @@ require 'date' describe "Date#eql?" do it "returns true if self is equal to another date" do - Date.civil(2007, 10, 11).eql?(Date.civil(2007, 10, 11)).should be_true + Date.civil(2007, 10, 11).eql?(Date.civil(2007, 10, 11)).should == true end it "returns false if self is not equal to another date" do - Date.civil(2007, 10, 11).eql?(Date.civil(2007, 10, 12)).should be_false + Date.civil(2007, 10, 11).eql?(Date.civil(2007, 10, 12)).should == false end end diff --git a/spec/ruby/library/date/friday_spec.rb b/spec/ruby/library/date/friday_spec.rb index 3dc040fabe..62f050346e 100644 --- a/spec/ruby/library/date/friday_spec.rb +++ b/spec/ruby/library/date/friday_spec.rb @@ -3,10 +3,10 @@ require 'date' describe "Date#friday?" do it "should be friday" do - Date.new(2000, 1, 7).friday?.should be_true + Date.new(2000, 1, 7).friday?.should == true end it "should not be friday" do - Date.new(2000, 1, 8).friday?.should be_false + Date.new(2000, 1, 8).friday?.should == false end end diff --git a/spec/ruby/library/date/gregorian_leap_spec.rb b/spec/ruby/library/date/gregorian_leap_spec.rb index c3d25cf90f..c27890faf4 100644 --- a/spec/ruby/library/date/gregorian_leap_spec.rb +++ b/spec/ruby/library/date/gregorian_leap_spec.rb @@ -3,13 +3,13 @@ require 'date' describe "Date#gregorian_leap?" do it "returns true if a year is a leap year in the Gregorian calendar" do - Date.gregorian_leap?(2000).should be_true - Date.gregorian_leap?(2004).should be_true + Date.gregorian_leap?(2000).should == true + Date.gregorian_leap?(2004).should == true end it "returns false if a year is not a leap year in the Gregorian calendar" do - Date.gregorian_leap?(1900).should be_false - Date.gregorian_leap?(1999).should be_false - Date.gregorian_leap?(2002).should be_false + Date.gregorian_leap?(1900).should == false + Date.gregorian_leap?(1999).should == false + Date.gregorian_leap?(2002).should == false end end diff --git a/spec/ruby/library/date/gregorian_spec.rb b/spec/ruby/library/date/gregorian_spec.rb index ea7ece2ade..bbda13af08 100644 --- a/spec/ruby/library/date/gregorian_spec.rb +++ b/spec/ruby/library/date/gregorian_spec.rb @@ -4,13 +4,13 @@ require 'date' describe "Date#gregorian?" do it "marks a day before the calendar reform as Julian" do - Date.civil(1007, 2, 27).gregorian?.should be_false - Date.civil(1907, 2, 27, Date.civil(1930, 1, 1).jd).gregorian?.should be_false + Date.civil(1007, 2, 27).gregorian?.should == false + Date.civil(1907, 2, 27, Date.civil(1930, 1, 1).jd).gregorian?.should == false end it "marks a day after the calendar reform as Julian" do Date.civil(2007, 2, 27).should.gregorian? - Date.civil(1607, 2, 27, Date.civil(1582, 1, 1).jd).gregorian?.should be_true + Date.civil(1607, 2, 27, Date.civil(1582, 1, 1).jd).gregorian?.should == true end end diff --git a/spec/ruby/library/date/iso8601_spec.rb b/spec/ruby/library/date/iso8601_spec.rb index af66845a6b..26815bd76c 100644 --- a/spec/ruby/library/date/iso8601_spec.rb +++ b/spec/ruby/library/date/iso8601_spec.rb @@ -25,17 +25,17 @@ describe "Date.iso8601" do it "raises a Date::Error if the argument is a invalid Date" do -> { Date.iso8601('invalid') - }.should raise_error(Date::Error, "invalid date") + }.should.raise(Date::Error, "invalid date") end it "raises a Date::Error when passed a nil" do -> { Date.iso8601(nil) - }.should raise_error(Date::Error, "invalid date") + }.should.raise(Date::Error, "invalid date") end it "raises a TypeError when passed an Object" do - -> { Date.iso8601(Object.new) }.should raise_error(TypeError) + -> { Date.iso8601(Object.new) }.should.raise(TypeError) end end @@ -51,6 +51,6 @@ describe "Date._iso8601" do end it "raises a TypeError when passed an Object" do - -> { Date._iso8601(Object.new) }.should raise_error(TypeError) + -> { Date._iso8601(Object.new) }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/julian_leap_spec.rb b/spec/ruby/library/date/julian_leap_spec.rb index 2ef2d65d81..42231e012f 100644 --- a/spec/ruby/library/date/julian_leap_spec.rb +++ b/spec/ruby/library/date/julian_leap_spec.rb @@ -3,13 +3,13 @@ require 'date' describe "Date.julian_leap?" do it "determines whether a year is a leap year in the Julian calendar" do - Date.julian_leap?(1900).should be_true - Date.julian_leap?(2000).should be_true - Date.julian_leap?(2004).should be_true + Date.julian_leap?(1900).should == true + Date.julian_leap?(2000).should == true + Date.julian_leap?(2004).should == true end it "determines whether a year is not a leap year in the Julian calendar" do - Date.julian_leap?(1999).should be_false - Date.julian_leap?(2002).should be_false + Date.julian_leap?(1999).should == false + Date.julian_leap?(2002).should == false end end diff --git a/spec/ruby/library/date/julian_spec.rb b/spec/ruby/library/date/julian_spec.rb index db2629d1e7..9f8a670899 100644 --- a/spec/ruby/library/date/julian_spec.rb +++ b/spec/ruby/library/date/julian_spec.rb @@ -5,12 +5,12 @@ describe "Date#julian?" do it "marks a day before the calendar reform as Julian" do Date.civil(1007, 2, 27).should.julian? - Date.civil(1907, 2, 27, Date.civil(1930, 1, 1).jd).julian?.should be_true + Date.civil(1907, 2, 27, Date.civil(1930, 1, 1).jd).julian?.should == true end it "marks a day after the calendar reform as Julian" do Date.civil(2007, 2, 27).should_not.julian? - Date.civil(1607, 2, 27, Date.civil(1582, 1, 1).jd).julian?.should be_false + Date.civil(1607, 2, 27, Date.civil(1582, 1, 1).jd).julian?.should == false end end diff --git a/spec/ruby/library/date/minus_month_spec.rb b/spec/ruby/library/date/minus_month_spec.rb index 470c4d8a76..d56e19dc31 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 - -> { 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) + -> { Date.civil(2007,2,27) << :hello }.should.raise(TypeError) + -> { Date.civil(2007,2,27) << "hello" }.should.raise(TypeError) + -> { Date.civil(2007,2,27) << Date.new }.should.raise(TypeError) + -> { Date.civil(2007,2,27) << Object.new }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/minus_spec.rb b/spec/ruby/library/date/minus_spec.rb index 5a2a29e04a..c2a08fa5b0 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 - -> { 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) + -> { Date.civil(2007,2,27) - :hello }.should.raise(TypeError) + -> { Date.civil(2007,2,27) - "hello" }.should.raise(TypeError) + -> { Date.civil(2007,2,27) - Object.new }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/monday_spec.rb b/spec/ruby/library/date/monday_spec.rb index 14a117b73c..61d728f3c5 100644 --- a/spec/ruby/library/date/monday_spec.rb +++ b/spec/ruby/library/date/monday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#monday?" do it "should be monday" do - Date.new(2000, 1, 3).monday?.should be_true + Date.new(2000, 1, 3).monday?.should == true end end diff --git a/spec/ruby/library/date/parse_spec.rb b/spec/ruby/library/date/parse_spec.rb index 5ef4f6e9b5..4d655f516e 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 - ->{ Date.parse("1") }.should raise_error(ArgumentError) + ->{ Date.parse("1") }.should.raise(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 - -> { Date.parse(1) }.should raise_error(TypeError) - -> { Date.parse([]) }.should raise_error(TypeError) + -> { Date.parse(1) }.should.raise(TypeError) + -> { Date.parse([]) }.should.raise(TypeError) end it "coerces using to_str" do diff --git a/spec/ruby/library/date/plus_spec.rb b/spec/ruby/library/date/plus_spec.rb index 0cb99fd4ca..6179370fca 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 - -> { Date.today + Date.today }.should raise_error(TypeError) + -> { Date.today + Date.today }.should.raise(TypeError) end end diff --git a/spec/ruby/library/date/saturday_spec.rb b/spec/ruby/library/date/saturday_spec.rb index 1527b71d00..29f8267a2b 100644 --- a/spec/ruby/library/date/saturday_spec.rb +++ b/spec/ruby/library/date/saturday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#saturday?" do it "should be saturday" do - Date.new(2000, 1, 1).saturday?.should be_true + Date.new(2000, 1, 1).saturday?.should == true end end diff --git a/spec/ruby/library/date/shared/civil.rb b/spec/ruby/library/date/shared/civil.rb index bbed4a8866..4499cdf8e9 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 - -> { 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) + -> { Date.send(@method, 2000, 13, 31) }.should.raise(ArgumentError) + -> { Date.send(@method, 2000, 12, 32) }.should.raise(ArgumentError) + -> { Date.send(@method, 2000, 2, 30) }.should.raise(ArgumentError) + -> { Date.send(@method, 1900, 2, 29) }.should.raise(ArgumentError) + -> { Date.send(@method, 2000, 2, 29) }.should_not.raise(ArgumentError) + + -> { Date.send(@method, 1582, 10, 14) }.should.raise(ArgumentError) + -> { Date.send(@method, 1582, 10, 15) }.should_not.raise(ArgumentError) end diff --git a/spec/ruby/library/date/shared/commercial.rb b/spec/ruby/library/date/shared/commercial.rb index 39c9af47b6..f53d83235a 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 - -> { 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) + -> { Date.send(@method, 2004, 53, 1) }.should_not.raise(ArgumentError) + -> { Date.send(@method, 2004, 53, 0) }.should.raise(ArgumentError) + -> { Date.send(@method, 2004, 53, 8) }.should.raise(ArgumentError) + -> { Date.send(@method, 2004, 54, 1) }.should.raise(ArgumentError) + -> { Date.send(@method, 2004, 0, 1) }.should.raise(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) + -> { Date.send(@method, 2003, 52, 1) }.should_not.raise(ArgumentError) + -> { Date.send(@method, 2003, 53, 1) }.should.raise(ArgumentError) + -> { Date.send(@method, 2003, 52, 0) }.should.raise(ArgumentError) + -> { Date.send(@method, 2003, 52, 8) }.should.raise(ArgumentError) end end diff --git a/spec/ruby/library/date/shared/valid_civil.rb b/spec/ruby/library/date/shared/valid_civil.rb index 545c207bbe..425fee4d2d 100644 --- a/spec/ruby/library/date/shared/valid_civil.rb +++ b/spec/ruby/library/date/shared/valid_civil.rb @@ -9,8 +9,8 @@ describe :date_valid_civil?, shared: true do # 31 it "returns true if it is a valid civil date" do - Date.send(@method, 1582, 10, 15).should be_true - Date.send(@method, 1582, 10, 14, Date::ENGLAND).should be_true + Date.send(@method, 1582, 10, 15).should == true + Date.send(@method, 1582, 10, 14, Date::ENGLAND).should == true end it "returns false if it is not a valid civil date" do @@ -24,13 +24,13 @@ describe :date_valid_civil?, shared: true do # -15 -14 -13 -12 -11 -10 -9 # -8 -7 -6 -5 -4 -3 -2 # -1 - Date.send(@method, 1582, -3, -22).should be_false - Date.send(@method, 1582, -3, -21).should be_true - Date.send(@method, 1582, -3, -18).should be_true - Date.send(@method, 1582, -3, -17).should be_true + Date.send(@method, 1582, -3, -22).should == false + Date.send(@method, 1582, -3, -21).should == true + Date.send(@method, 1582, -3, -18).should == true + Date.send(@method, 1582, -3, -17).should == true - Date.send(@method, 2007, -11, -10).should be_true - Date.send(@method, 2008, -11, -10).should be_true + Date.send(@method, 2007, -11, -10).should == true + Date.send(@method, 2008, -11, -10).should == true end end diff --git a/spec/ruby/library/date/shared/valid_commercial.rb b/spec/ruby/library/date/shared/valid_commercial.rb index 117dfe1d3d..573b851fdd 100644 --- a/spec/ruby/library/date/shared/valid_commercial.rb +++ b/spec/ruby/library/date/shared/valid_commercial.rb @@ -6,16 +6,16 @@ describe :date_valid_commercial?, shared: true do # 39: 1 2 3 4 5 6 7 # 40: 1 2 3 4 5 6 7 # 41: 1 2 3 4 5 6 7 - Date.send(@method, 1582, 39, 4).should be_true - Date.send(@method, 1582, 39, 5).should be_true - Date.send(@method, 1582, 41, 4).should be_true - Date.send(@method, 1582, 41, 5).should be_true - Date.send(@method, 1582, 41, 4, Date::ENGLAND).should be_true - Date.send(@method, 1752, 37, 4, Date::ENGLAND).should be_true + Date.send(@method, 1582, 39, 4).should == true + Date.send(@method, 1582, 39, 5).should == true + Date.send(@method, 1582, 41, 4).should == true + Date.send(@method, 1582, 41, 5).should == true + Date.send(@method, 1582, 41, 4, Date::ENGLAND).should == true + Date.send(@method, 1752, 37, 4, Date::ENGLAND).should == true end it "returns false it is not a valid commercial date" do - Date.send(@method, 1999, 53, 1).should be_false + Date.send(@method, 1999, 53, 1).should == false end it "handles negative week and day numbers" do @@ -24,11 +24,11 @@ describe :date_valid_commercial?, shared: true do # -12: -7 -6 -5 -4 -3 -2 -1 # -11: -7 -6 -5 -4 -3 -2 -1 # -10: -7 -6 -5 -4 -3 -2 -1 - Date.send(@method, 1582, -12, -4).should be_true - Date.send(@method, 1582, -12, -3).should be_true - Date.send(@method, 2007, -44, -2).should be_true - Date.send(@method, 2008, -44, -2).should be_true - Date.send(@method, 1999, -53, -1).should be_false + Date.send(@method, 1582, -12, -4).should == true + Date.send(@method, 1582, -12, -3).should == true + Date.send(@method, 2007, -44, -2).should == true + Date.send(@method, 2008, -44, -2).should == true + Date.send(@method, 1999, -53, -1).should == false end end diff --git a/spec/ruby/library/date/shared/valid_jd.rb b/spec/ruby/library/date/shared/valid_jd.rb index e474dfb450..0c01710208 100644 --- a/spec/ruby/library/date/shared/valid_jd.rb +++ b/spec/ruby/library/date/shared/valid_jd.rb @@ -1,20 +1,20 @@ describe :date_valid_jd?, shared: true do it "returns true if passed a number value" do - Date.send(@method, -100).should be_true - Date.send(@method, 100.0).should be_true - Date.send(@method, 2**100).should be_true - Date.send(@method, Rational(1,2)).should be_true + Date.send(@method, -100).should == true + Date.send(@method, 100.0).should == true + Date.send(@method, 2**100).should == true + Date.send(@method, Rational(1,2)).should == true end it "returns false if passed nil" do - Date.send(@method, nil).should be_false + Date.send(@method, nil).should == false end it "returns false if passed symbol" do - Date.send(@method, :number).should be_false + Date.send(@method, :number).should == false end it "returns false if passed false" do - Date.send(@method, false).should be_false + Date.send(@method, false).should == false end end diff --git a/spec/ruby/library/date/strftime_spec.rb b/spec/ruby/library/date/strftime_spec.rb index b5232a2073..1b93a8d1b2 100644 --- a/spec/ruby/library/date/strftime_spec.rb +++ b/spec/ruby/library/date/strftime_spec.rb @@ -23,19 +23,9 @@ describe "Date#strftime" do @date.strftime("%Z").should == "+00:00" end - # %v is %e-%b-%Y for Date/DateTime - version_is date_version, ""..."3.2" do #ruby_version_is ""..."3.1" do - it "should be able to show the commercial week" do - @date.strftime("%v").should == " 9-Apr-2000" - @date.strftime("%v").should == @date.strftime('%e-%b-%Y') - end - end - - version_is date_version, "3.2" do #ruby_version_is "3.1" do - it "should be able to show the commercial week" do - @date.strftime("%v").should == " 9-APR-2000" - @date.strftime("%v").should != @date.strftime('%e-%b-%Y') - end + it "should be able to show the commercial week" do + @date.strftime("%v").should == " 9-APR-2000" + @date.strftime("%v").should != @date.strftime('%e-%b-%Y') end # additional conversion specifiers only in Date/DateTime diff --git a/spec/ruby/library/date/sunday_spec.rb b/spec/ruby/library/date/sunday_spec.rb index c3a817fa86..548f36a4f0 100644 --- a/spec/ruby/library/date/sunday_spec.rb +++ b/spec/ruby/library/date/sunday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#sunday?" do it "should be sunday" do - Date.new(2000, 1, 2).sunday?.should be_true + Date.new(2000, 1, 2).sunday?.should == true end end diff --git a/spec/ruby/library/date/thursday_spec.rb b/spec/ruby/library/date/thursday_spec.rb index 74b5f40365..4df3b9103a 100644 --- a/spec/ruby/library/date/thursday_spec.rb +++ b/spec/ruby/library/date/thursday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#thursday?" do it "should be thursday" do - Date.new(2000, 1, 6).thursday?.should be_true + Date.new(2000, 1, 6).thursday?.should == true end end diff --git a/spec/ruby/library/date/today_spec.rb b/spec/ruby/library/date/today_spec.rb index 7c6ebc9cb4..4be8d8e931 100644 --- a/spec/ruby/library/date/today_spec.rb +++ b/spec/ruby/library/date/today_spec.rb @@ -3,7 +3,7 @@ require 'date' describe "Date.today" do it "returns a Date object" do - Date.today.should be_kind_of Date + Date.today.should.is_a? Date end it "sets Date object to the current date" do diff --git a/spec/ruby/library/date/tuesday_spec.rb b/spec/ruby/library/date/tuesday_spec.rb index 052837b54e..db31387aed 100644 --- a/spec/ruby/library/date/tuesday_spec.rb +++ b/spec/ruby/library/date/tuesday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#tuesday?" do it "should be tuesday" do - Date.new(2000, 1, 4).tuesday?.should be_true + Date.new(2000, 1, 4).tuesday?.should == true end end diff --git a/spec/ruby/library/date/wednesday_spec.rb b/spec/ruby/library/date/wednesday_spec.rb index e80ec23dd2..4bbeead5b8 100644 --- a/spec/ruby/library/date/wednesday_spec.rb +++ b/spec/ruby/library/date/wednesday_spec.rb @@ -3,6 +3,6 @@ require 'date' describe "Date#wednesday?" do it "should be wednesday" do - Date.new(2000, 1, 5).wednesday?.should be_true + Date.new(2000, 1, 5).wednesday?.should == true end end |
