spec/nsdate_spec.rb in sugarcube-0.20.23 vs spec/nsdate_spec.rb in sugarcube-0.20.24

- old
+ new

@@ -16,30 +16,48 @@ date.hour.should == 0 date.min.should == 0 date.sec.should == 0 end + it "NSDate##today method should be equal to itself" do + date1 = NSDate.today + date2 = NSDate.today + date1.should == date2 + end + it "Should have an NSDate##yesterday method" do now = NSDate.today date = NSDate.yesterday date.hour.should == 0 date.min.should == 0 date.sec.should == 0 (now - date).in_hours.should >= 23 # keep in mind daylight (now - date).in_hours.should <= 25 # savings time. end + it "NSDate##yesterday method should be equal to itself" do + date1 = NSDate.yesterday + date2 = NSDate.yesterday + date1.should == date2 + end + it "Should have an NSDate##tomorrow method" do now = NSDate.today date = NSDate.tomorrow date.hour.should == 0 date.min.should == 0 date.sec.should == 0 (date - now).in_hours.should >= 23 # keep in mind daylight (date - now).in_hours.should <= 25 # savings time. end + it "NSDate##tomorrow method should be equal to itself" do + date1 = NSDate.tomorrow + date2 = NSDate.tomorrow + date1.should == date2 + end + before do @date = NSDate.from_components(year: 2013, month: 1, day: 2, hour:12, minute: 15, second: 30) end it "should have an NSDate#string_with_style(date_style, time_style) method that accepts symbols" do @@ -112,11 +130,19 @@ it "should have an NSDate#start_of_day method" do @date.start_of_day.datetime_array.should == [2013, 1, 2, 0, 0, 0] end + it "NSDate#start_of_day should be equal to itself" do + @date.start_of_day.should == @date.start_of_day + end + it "should have an NSDate#end_of_day method" do @date.end_of_day.datetime_array.should == [2013, 1, 3, 0, 0, 0] + end + + it "NSDate#end_of_day should be equal to itself" do + @date.end_of_day.should == @date.end_of_day end it "should have an NSDate#start_of_week method" do @date.start_of_week(:sunday).datetime_array.should == [2012, 12, 30, 0, 0, 0] end