|
84 | 84 | end
|
85 | 85 | end
|
86 | 86 |
|
87 |
| - describe "#prev" do |
88 |
| - it "returns the previous date from self" do |
89 |
| - Date.new(2013, 3, 5).prev.should == Date.new(2013, 3, 4) |
90 |
| - Date.new(2013, 6, 1).prev.should == Date.new(2013, 5, 31) |
91 |
| - Date.new(2014, 1, 1).prev.should == Date.new(2013, 12, 31) |
92 |
| - end |
93 |
| - end |
94 |
| - |
95 | 87 | describe "#prev_month" do
|
96 | 88 | it "returns the date with the previous calendar month" do
|
97 | 89 | Date.new(2013, 2, 9).prev_month.should == Date.new(2013, 1, 9)
|
|
100 | 92 | end
|
101 | 93 | end
|
102 | 94 |
|
| 95 | + describe '#next_day' do |
| 96 | + it 'returns a new date the given number of days after self' do |
| 97 | + Date.new(2014, 4, 5).next_day.should == Date.new(2014, 4, 6) |
| 98 | + Date.new(2014, 4, 5).next_day(4).should == Date.new(2014, 4, 9) |
| 99 | + end |
| 100 | + end |
| 101 | + |
| 102 | + describe '#prev_day' do |
| 103 | + it 'returns the date the given number of days before self' do |
| 104 | + Date.new(2014, 4, 5).prev_day.should == Date.new(2014, 4, 4) |
| 105 | + Date.new(2014, 4, 5).prev_day(4).should == Date.new(2014, 4, 1) |
| 106 | + end |
| 107 | + end |
| 108 | + |
| 109 | + describe '#succ' do |
| 110 | + it 'returns the date after the receiver' do |
| 111 | + Date.new(1986, 5, 26).succ.should == Date.new(1986, 5, 27) |
| 112 | + end |
| 113 | + end |
| 114 | + |
103 | 115 | describe "#to_s" do
|
104 | 116 | it "returns an ISO 8601 representation" do
|
105 | 117 | Date.new(2013, 10, 15).to_s.should == "2013-10-15"
|
|
119 | 131 | Date.new(2013, 2, 9).year.should == 2013
|
120 | 132 | end
|
121 | 133 | end
|
| 134 | + |
| 135 | + it 'correctly reports mondays' do |
| 136 | + Date.new(2015, 4, 6).monday?.should be_true |
| 137 | + end |
| 138 | + |
| 139 | + it 'correctly reports tuesdays' do |
| 140 | + Date.new(2015, 4, 7).tuesday?.should be_true |
| 141 | + end |
| 142 | + |
| 143 | + it 'correctly reports wednesdays' do |
| 144 | + Date.new(2015, 4, 8).wednesday?.should be_true |
| 145 | + end |
| 146 | + |
| 147 | + it 'correctly reports thursdays' do |
| 148 | + Date.new(2015, 4, 9).thursday?.should be_true |
| 149 | + end |
| 150 | + |
| 151 | + it 'correctly reports fridays' do |
| 152 | + Date.new(2015, 4, 10).friday?.should be_true |
| 153 | + end |
| 154 | + |
| 155 | + it 'correctly reports saturdays' do |
| 156 | + Date.new(2015, 4, 11).saturday?.should be_true |
| 157 | + end |
| 158 | + |
| 159 | + it 'correctly reports sundays' do |
| 160 | + Date.new(2015, 4, 12).sunday?.should be_true |
| 161 | + end |
| 162 | + |
122 | 163 | end
|
0 commit comments