From 473fa1dafd2f8513769668cb8b2a8eaf54b0e5ac Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Wed, 9 Apr 2025 21:28:29 +0200 Subject: [PATCH] Rename constant --- app/models/card/closeable.rb | 6 +++--- test/models/card/closeable_test.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/card/closeable.rb b/app/models/card/closeable.rb index bcc41308a..3f98cb719 100644 --- a/app/models/card/closeable.rb +++ b/app/models/card/closeable.rb @@ -1,7 +1,7 @@ module Card::Closeable extend ActiveSupport::Concern - AUTO_CLOSURE_AFTER = 30.days + AUTO_CLOSE_AFTER = 30.days included do has_one :closure, dependent: :destroy @@ -10,7 +10,7 @@ module Card::Closeable scope :active, -> { where.missing(:closure) } scope :recently_closed_first, -> { closed.order("closures.created_at": :desc) } - scope :due_to_be_closed, -> { considering.where(last_active_at: ..AUTO_CLOSURE_AFTER.ago) } + scope :due_to_be_closed, -> { considering.where(last_active_at: ..AUTO_CLOSE_AFTER.ago) } end class_methods do @@ -22,7 +22,7 @@ module Card::Closeable end def auto_close_at - last_active_at + AUTO_CLOSURE_AFTER if last_active_at + last_active_at + AUTO_CLOSE_AFTER if last_active_at end def closed? diff --git a/test/models/card/closeable_test.rb b/test/models/card/closeable_test.rb index 8cfee3e8b..b8effec74 100644 --- a/test/models/card/closeable_test.rb +++ b/test/models/card/closeable_test.rb @@ -18,8 +18,8 @@ class Card::CloseableTest < ActiveSupport::TestCase test "auto_close_all_due" do cards(:logo, :shipping).each(&:reconsider) - cards(:logo).update!(last_active_at: 1.day.ago - Card::Closeable::AUTO_CLOSURE_AFTER) - cards(:shipping).update!(last_active_at: 1.day.from_now - Card::Closeable::AUTO_CLOSURE_AFTER) + cards(:logo).update!(last_active_at: 1.day.ago - Card::Closeable::AUTO_CLOSE_AFTER) + cards(:shipping).update!(last_active_at: 1.day.from_now - Card::Closeable::AUTO_CLOSE_AFTER) assert_difference -> { Card.closed.count }, +1 do Card.auto_close_all_due