|
4 | 4 | describe "#all" do |
5 | 5 | subject { travel_to(today) { described_class.all } } |
6 | 6 |
|
7 | | - context "in 2024" do |
| 7 | + context "first day of 2024" do |
8 | 8 | let(:today) { Date.new(2024, 9, 1) } |
9 | 9 |
|
10 | 10 | it { should eq([2024]) } |
11 | 11 | end |
12 | 12 |
|
13 | | - context "in 2025" do |
| 13 | + context "last day of only 2024" do |
| 14 | + let(:today) { Date.new(2025, 7, 31) } |
| 15 | + |
| 16 | + it { should eq([2024]) } |
| 17 | + end |
| 18 | + |
| 19 | + context "preparing for 2025" do |
| 20 | + let(:today) { Date.new(2025, 8, 1) } |
| 21 | + |
| 22 | + it { should eq([2024, 2025]) } |
| 23 | + end |
| 24 | + |
| 25 | + context "first day of 2025" do |
14 | 26 | let(:today) { Date.new(2025, 9, 1) } |
15 | 27 |
|
16 | 28 | it { should eq([2024, 2025]) } |
|
20 | 32 | describe "#current" do |
21 | 33 | subject { travel_to(today) { described_class.current } } |
22 | 34 |
|
23 | | - context "in 2024" do |
| 35 | + context "first day of 2024" do |
24 | 36 | let(:today) { Date.new(2024, 9, 1) } |
25 | 37 |
|
26 | 38 | it { should eq(2024) } |
27 | 39 | end |
28 | 40 |
|
29 | | - context "in 2025" do |
| 41 | + context "first day of 2025" do |
30 | 42 | let(:today) { Date.new(2025, 9, 1) } |
31 | 43 |
|
32 | 44 | it { should eq(2025) } |
|
36 | 48 | describe "#first" do |
37 | 49 | subject { travel_to(today) { described_class.first } } |
38 | 50 |
|
39 | | - context "in 2023" do |
| 51 | + context "first day of 2023" do |
40 | 52 | let(:today) { Date.new(2023, 9, 1) } |
41 | 53 |
|
42 | 54 | it { should eq(2023) } |
43 | 55 | end |
44 | 56 |
|
45 | | - context "in 2024" do |
| 57 | + context "first day of 2024" do |
46 | 58 | let(:today) { Date.new(2024, 9, 1) } |
47 | 59 |
|
48 | 60 | it { should eq(2024) } |
49 | 61 | end |
50 | 62 |
|
51 | | - context "in 2025" do |
| 63 | + context "first day of 2025" do |
52 | 64 | let(:today) { Date.new(2025, 9, 1) } |
53 | 65 |
|
54 | 66 | it { should eq(2024) } |
|
58 | 70 | describe "#last" do |
59 | 71 | subject { travel_to(today) { described_class.last } } |
60 | 72 |
|
61 | | - context "in 2024" do |
| 73 | + context "first day of 2024" do |
62 | 74 | let(:today) { Date.new(2024, 9, 1) } |
63 | 75 |
|
64 | 76 | it { should eq(2024) } |
65 | 77 | end |
66 | 78 |
|
67 | | - context "in 2025" do |
| 79 | + context "last day of only 2024" do |
| 80 | + let(:today) { Date.new(2025, 7, 31) } |
| 81 | + |
| 82 | + it { should eq(2024) } |
| 83 | + end |
| 84 | + |
| 85 | + context "preparing for 2025" do |
| 86 | + let(:today) { Date.new(2025, 8, 1) } |
| 87 | + |
| 88 | + it { should eq(2025) } |
| 89 | + end |
| 90 | + |
| 91 | + context "first day of 2025" do |
68 | 92 | let(:today) { Date.new(2025, 9, 1) } |
69 | 93 |
|
70 | 94 | it { should eq(2025) } |
71 | 95 | end |
72 | 96 | end |
| 97 | + |
| 98 | + describe "#preparation?" do |
| 99 | + subject { travel_to(today) { described_class.preparation? } } |
| 100 | + |
| 101 | + context "first day of 2024" do |
| 102 | + let(:today) { Date.new(2024, 9, 1) } |
| 103 | + |
| 104 | + it { should be(false) } |
| 105 | + end |
| 106 | + |
| 107 | + context "last day of only 2024" do |
| 108 | + let(:today) { Date.new(2025, 7, 31) } |
| 109 | + |
| 110 | + it { should be(false) } |
| 111 | + end |
| 112 | + |
| 113 | + context "preparing for 2025" do |
| 114 | + let(:today) { Date.new(2025, 8, 1) } |
| 115 | + |
| 116 | + it { should be(true) } |
| 117 | + end |
| 118 | + |
| 119 | + context "first day of 2025" do |
| 120 | + let(:today) { Date.new(2025, 9, 1) } |
| 121 | + |
| 122 | + it { should be(false) } |
| 123 | + end |
| 124 | + end |
73 | 125 | end |
0 commit comments