|
211 | 211 |
|
212 | 212 | context "when all sentences are dates" do
|
213 | 213 | context "and there is overlapping of rehabilitation periods" do
|
214 |
| - let(:conviction_1) do |
215 |
| - instance_double( |
216 |
| - Calculators::Multiples::Proceedings, |
217 |
| - conviction?: true, |
218 |
| - conviction_date: Date.new(2020, 1, 1), |
219 |
| - spent_date: Date.new(2022, 1, 1), |
220 |
| - spent_date_without_relevant_orders: Date.new(2022, 1, 1), |
221 |
| - ) |
222 |
| - end |
223 |
| - |
224 |
| - let(:conviction_2) do |
225 |
| - instance_double( |
226 |
| - Calculators::Multiples::Proceedings, |
227 |
| - conviction?: true, |
228 |
| - conviction_date: Date.new(2021, 1, 1), |
229 |
| - spent_date: Date.new(2025, 1, 1), |
230 |
| - spent_date_without_relevant_orders: Date.new(2025, 1, 1), |
231 |
| - ) |
| 214 | + context "when 2nd sentence causes drag through" do |
| 215 | + let(:conviction_1) do |
| 216 | + instance_double( |
| 217 | + Calculators::Multiples::Proceedings, |
| 218 | + conviction?: true, |
| 219 | + conviction_date: Date.new(2020, 1, 1), |
| 220 | + spent_date: Date.new(2022, 1, 1), |
| 221 | + spent_date_without_relevant_orders: Date.new(2022, 1, 1), |
| 222 | + ) |
| 223 | + end |
| 224 | + |
| 225 | + let(:conviction_2) do |
| 226 | + instance_double( |
| 227 | + Calculators::Multiples::Proceedings, |
| 228 | + conviction?: true, |
| 229 | + conviction_date: Date.new(2021, 1, 1), |
| 230 | + spent_date: Date.new(2025, 1, 1), |
| 231 | + spent_date_without_relevant_orders: Date.new(2025, 1, 1), |
| 232 | + ) |
| 233 | + end |
| 234 | + |
| 235 | + it "returns the spent date for the matching check group" do |
| 236 | + expect(calculator.spent_date_for(conviction_1)).to eq(Date.new(2025, 1, 1)) |
| 237 | + expect(calculator.spent_date_for(conviction_2)).to eq(Date.new(2025, 1, 1)) |
| 238 | + end |
232 | 239 | end
|
233 | 240 |
|
234 |
| - it "returns the spent date for the matching check group" do |
235 |
| - expect(calculator.spent_date_for(conviction_1)).to eq(Date.new(2025, 1, 1)) |
236 |
| - expect(calculator.spent_date_for(conviction_2)).to eq(Date.new(2025, 1, 1)) |
| 241 | + context "when 1st sentence causes drag through" do |
| 242 | + let(:conviction_1) do |
| 243 | + instance_double( |
| 244 | + Calculators::Multiples::Proceedings, |
| 245 | + conviction?: true, |
| 246 | + conviction_date: Date.new(2019, 4, 23), |
| 247 | + spent_date: Date.new(2030, 4, 22), |
| 248 | + spent_date_without_relevant_orders: Date.new(2030, 4, 22), |
| 249 | + ) |
| 250 | + end |
| 251 | + |
| 252 | + let(:conviction_2) do |
| 253 | + instance_double( |
| 254 | + Calculators::Multiples::Proceedings, |
| 255 | + conviction?: true, |
| 256 | + conviction_date: Date.new(2023, 9, 23), |
| 257 | + spent_date: Date.new(2026, 3, 22), |
| 258 | + spent_date_without_relevant_orders: Date.new(2026, 3, 22), |
| 259 | + ) |
| 260 | + end |
| 261 | + |
| 262 | + it "returns the spent date for the matching check group" do |
| 263 | + expect(calculator.spent_date_for(conviction_1)).to eq(Date.new(2030, 4, 22)) |
| 264 | + expect(calculator.spent_date_for(conviction_2)).to eq(Date.new(2030, 4, 22)) |
| 265 | + end |
237 | 266 | end
|
238 | 267 | end
|
239 | 268 |
|
|
352 | 381 | let(:spent_date_2) { ResultsVariant::INDEFINITE }
|
353 | 382 |
|
354 | 383 | it "returns the spent date for the matching check group" do
|
355 |
| - expect(calculator.spent_date_for(conviction_1)).to eq(ResultsVariant::INDEFINITE) |
| 384 | + expect(calculator.spent_date_for(conviction_1)).to eq(Date.new(2023, 1, 1)) |
356 | 385 | expect(calculator.spent_date_for(conviction_2)).to eq(ResultsVariant::INDEFINITE)
|
357 | 386 | end
|
358 | 387 | end
|
|
0 commit comments