Skip to content

Commit 51a1ca7

Browse files
committed
Ranges instead of upto
1 parent ae19fe3 commit 51a1ca7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

3-test-driving-activerecord-models/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Add this test method to the `TestPresidencyModel` class inside `activerecord_tes
549549

550550
```ruby
551551
def test_that_it_checks_for_overlapping_presidency_terms
552-
2021.upto(2022) do |year|
552+
(2021..2022).each do |year|
553553
Presidency.where("? BETWEEN year_from AND year_to", year).first.destroy rescue NoMethodError
554554
end
555555
p1 = Presidency.new :first_name => "John", :other_names => "Doe", :year_from => 2021, :year_to => 2022
@@ -591,7 +591,7 @@ git commit -am "RED: test_that_it_checks_for_overlapping_presidency_terms"
591591
end
592592
if yf != 0 && yt != 0 && ok_to_validate_overlap
593593
how_many_overlaps = 0
594-
yf.upto(yt) do |year|
594+
(yf..yt).each do |year|
595595
how_many_overlaps += self.class.where("? BETWEEN year_from AND year_to", year).count
596596
end
597597
if how_many_overlaps != 0

0 commit comments

Comments
 (0)