From b3474ec97d555a83fc015ec8be4fdf7f44598aa4 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 2 Nov 2025 13:11:41 +0100 Subject: [PATCH] Rename Entropy::Configuration to just Entropy --- .../account/entropies_controller.rb | 11 +++++++++ .../entropy_configurations_controller.rb | 11 --------- .../collections/entropies_controller.rb | 17 +++++++++++++ .../entropy_configurations_controller.rb | 17 ------------- app/models/account.rb | 2 +- app/models/account/entropic.rb | 8 +++---- app/models/card/entropic.rb | 12 +++++----- app/models/collection.rb | 2 +- app/models/collection/entropic.rb | 10 ++++---- app/models/entropy.rb | 17 ++++++++++--- app/models/entropy/configuration.rb | 16 ------------- ...nfiguration.html.erb => _entropy.html.erb} | 2 +- app/views/account/settings/show.html.erb | 2 +- .../collections/edit/_auto_close.html.erb | 4 ++-- config/routes.rb | 4 ++-- ...ame_entropy_configurations_to_entropies.rb | 5 ++++ db/schema.rb | 6 ++--- db/schema_cache.yml | 16 ++++++------- .../accounts/entropies_controller_test.rb | 15 ++++++++++++ .../entropy_configurations_controller_test.rb | 15 ------------ .../collections/entropies_controller_test.rb | 16 +++++++++++++ .../entropy_configurations_controller_test.rb | 16 ------------- .../collections_controller_test.rb | 2 +- .../configurations.yml => entropies.yml} | 0 test/models/card/entropic_test.rb | 24 +++++++++---------- test/models/card/stallable_test.rb | 2 +- test/models/entropy/configuration_test.rb | 20 ---------------- test/models/entropy_test.rb | 20 ++++++++++++++++ test/routes_test.rb | 4 ++-- 29 files changed, 148 insertions(+), 148 deletions(-) create mode 100644 app/controllers/account/entropies_controller.rb delete mode 100644 app/controllers/account/entropy_configurations_controller.rb create mode 100644 app/controllers/collections/entropies_controller.rb delete mode 100644 app/controllers/collections/entropy_configurations_controller.rb delete mode 100644 app/models/entropy/configuration.rb rename app/views/account/settings/{_entropy_configuration.html.erb => _entropy.html.erb} (89%) create mode 100644 db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb create mode 100644 test/controllers/accounts/entropies_controller_test.rb delete mode 100644 test/controllers/accounts/entropy_configurations_controller_test.rb create mode 100644 test/controllers/collections/entropies_controller_test.rb delete mode 100644 test/controllers/collections/entropy_configurations_controller_test.rb rename test/fixtures/{entropy/configurations.yml => entropies.yml} (100%) delete mode 100644 test/models/entropy/configuration_test.rb create mode 100644 test/models/entropy_test.rb diff --git a/app/controllers/account/entropies_controller.rb b/app/controllers/account/entropies_controller.rb new file mode 100644 index 000000000..75fa01e20 --- /dev/null +++ b/app/controllers/account/entropies_controller.rb @@ -0,0 +1,11 @@ +class Account::EntropiesController < ApplicationController + def update + Entropy.default.update!(entropy_params) + redirect_to account_settings_path, notice: "Account updated" + end + + private + def entropy_params + params.expect(entropy: [ :auto_postpone_period ]) + end +end diff --git a/app/controllers/account/entropy_configurations_controller.rb b/app/controllers/account/entropy_configurations_controller.rb deleted file mode 100644 index 9de3ff04c..000000000 --- a/app/controllers/account/entropy_configurations_controller.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Account::EntropyConfigurationsController < ApplicationController - def update - Entropy::Configuration.default.update!(entropy_configuration_params) - redirect_to account_settings_path, notice: "Account updated" - end - - private - def entropy_configuration_params - params.expect(entropy_configuration: [ :auto_postpone_period ]) - end -end diff --git a/app/controllers/collections/entropies_controller.rb b/app/controllers/collections/entropies_controller.rb new file mode 100644 index 000000000..bb0d2940a --- /dev/null +++ b/app/controllers/collections/entropies_controller.rb @@ -0,0 +1,17 @@ +class Collections::EntropiesController < ApplicationController + include CollectionScoped + + def update + @collection.entropy.update!(entropy_params) + + render turbo_stream: [ + turbo_stream.replace([ @collection, :entropy], partial: "collections/edit/auto_close", locals: { collection: @collection }), + turbo_stream_flash(notice: "Saved") + ] + end + + private + def entropy_params + params.expect(collection: [ :auto_postpone_period ]) + end +end diff --git a/app/controllers/collections/entropy_configurations_controller.rb b/app/controllers/collections/entropy_configurations_controller.rb deleted file mode 100644 index 76957627d..000000000 --- a/app/controllers/collections/entropy_configurations_controller.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Collections::EntropyConfigurationsController < ApplicationController - include CollectionScoped - - def update - @collection.entropy_configuration.update!(entropy_configuration_params) - - render turbo_stream: [ - turbo_stream.replace([ @collection, :entropy_configuration ], partial: "collections/edit/auto_close", locals: { collection: @collection }), - turbo_stream_flash(notice: "Saved") - ] - end - - private - def entropy_configuration_params - params.expect(collection: [ :auto_postpone_period ]) - end -end diff --git a/app/models/account.rb b/app/models/account.rb index 357d0cc29..6c42bcdfb 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -16,7 +16,7 @@ class Account < ApplicationRecord end end - # To use the account as a generic card container. See +Entropy::Configuration+. + # To use the account as a generic card container. See +Entropy+. def cards Card.all end diff --git a/app/models/account/entropic.rb b/app/models/account/entropic.rb index b82b1051b..de6e3a7e6 100644 --- a/app/models/account/entropic.rb +++ b/app/models/account/entropic.rb @@ -2,16 +2,16 @@ module Account::Entropic extend ActiveSupport::Concern included do - has_one :default_entropy_configuration, class_name: "Entropy::Configuration", as: :container, dependent: :destroy + has_one :default_entropy, class_name: "Entropy", as: :container, dependent: :destroy - before_save :set_default_entropy_configuration + before_save :set_default_entropy end private DEFAULT_ENTROPY_PERIOD = 30.days - def set_default_entropy_configuration - self.default_entropy_configuration ||= build_default_entropy_configuration \ + def set_default_entropy + self.default_entropy ||= build_default_entropy \ auto_postpone_period: DEFAULT_ENTROPY_PERIOD end end diff --git a/app/models/card/entropic.rb b/app/models/card/entropic.rb index 46acd8da8..e938e232e 100644 --- a/app/models/card/entropic.rb +++ b/app/models/card/entropic.rb @@ -4,16 +4,16 @@ module Card::Entropic included do scope :due_to_be_postponed, -> do active - .left_outer_joins(collection: :entropy_configuration) - .where("last_active_at <= DATETIME('now', '-' || COALESCE(entropy_configurations.auto_postpone_period, ?) || ' seconds')", - Entropy::Configuration.default.auto_postpone_period) + .left_outer_joins(collection: :entropy) + .where("last_active_at <= DATETIME('now', '-' || COALESCE(entropies.auto_postpone_period, ?) || ' seconds')", + Entropy.default.auto_postpone_period) end scope :postponing_soon, -> do active - .left_outer_joins(collection: :entropy_configuration) - .where("last_active_at > DATETIME('now', '-' || COALESCE(entropy_configurations.auto_postpone_period, ?) || ' seconds')", Entropy::Configuration.default.auto_postpone_period) - .where("last_active_at <= DATETIME('now', '-' || CAST(COALESCE(entropy_configurations.auto_postpone_period, ?) * 0.75 AS INTEGER) || ' seconds')", Entropy::Configuration.default.auto_postpone_period) + .left_outer_joins(collection: :entropy) + .where("last_active_at > DATETIME('now', '-' || COALESCE(entropies.auto_postpone_period, ?) || ' seconds')", Entropy.default.auto_postpone_period) + .where("last_active_at <= DATETIME('now', '-' || CAST(COALESCE(entropies.auto_postpone_period, ?) * 0.75 AS INTEGER) || ' seconds')", Entropy.default.auto_postpone_period) end delegate :auto_postpone_period, to: :collection diff --git a/app/models/collection.rb b/app/models/collection.rb index 504439e2e..f1aef0fb7 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -8,7 +8,7 @@ class Collection < ApplicationRecord has_many :tags, -> { distinct }, through: :cards has_many :events has_many :webhooks, dependent: :destroy - has_one :entropy_configuration, class_name: "Entropy::Configuration", as: :container, dependent: :destroy + has_one :entropy, as: :container, dependent: :destroy scope :alphabetically, -> { order("lower(name)") } scope :ordered_by_recently_accessed, -> { merge(Access.ordered_by_recently_accessed) } diff --git a/app/models/collection/entropic.rb b/app/models/collection/entropic.rb index a3879955b..dbfb6a981 100644 --- a/app/models/collection/entropic.rb +++ b/app/models/collection/entropic.rb @@ -2,15 +2,15 @@ module Collection::Entropic extend ActiveSupport::Concern included do - delegate :auto_postpone_period, to: :entropy_configuration + delegate :auto_postpone_period, to: :entropy end - def entropy_configuration - super || Entropy::Configuration.default + def entropy + super || Entropy.default end def auto_postpone_period=(new_value) - entropy_configuration ||= association(:entropy_configuration).reader || self.build_entropy_configuration - entropy_configuration.update auto_postpone_period: new_value + entropy ||= association(:entropy).reader || self.build_entropy + entropy.update auto_postpone_period: new_value end end diff --git a/app/models/entropy.rb b/app/models/entropy.rb index 42e730a09..613d1a315 100644 --- a/app/models/entropy.rb +++ b/app/models/entropy.rb @@ -1,5 +1,16 @@ -module Entropy - def self.table_name_prefix - "entropy_" +class Entropy < ApplicationRecord + belongs_to :container, polymorphic: true + + after_commit :touch_all_cards_later + + class << self + def default + Account.sole.default_entropy + end end + + private + def touch_all_cards_later + Card::TouchAllJob.perform_later(container) + end end diff --git a/app/models/entropy/configuration.rb b/app/models/entropy/configuration.rb deleted file mode 100644 index 1884cb112..000000000 --- a/app/models/entropy/configuration.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Entropy::Configuration < ApplicationRecord - belongs_to :container, polymorphic: true - - after_commit :touch_all_cards_later - - class << self - def default - Account.sole.default_entropy_configuration - end - end - - private - def touch_all_cards_later - Card::TouchAllJob.perform_later(container) - end -end diff --git a/app/views/account/settings/_entropy_configuration.html.erb b/app/views/account/settings/_entropy.html.erb similarity index 89% rename from app/views/account/settings/_entropy_configuration.html.erb rename to app/views/account/settings/_entropy.html.erb index 9ecc64db6..316097898 100644 --- a/app/views/account/settings/_entropy_configuration.html.erb +++ b/app/views/account/settings/_entropy.html.erb @@ -4,5 +4,5 @@

BOXCAR doesn’t let stale cards stick around forever. Cards automatically close as “Not Now” without activity for specific period of time. This is the default, global setting — you can override it on each board.

- <%= render "entropy/auto_close", model: account.default_entropy_configuration, url: account_entropy_configuration_path %> + <%= render "entropy/auto_close", model: account.default_entropy, url: account_entropy_path %> diff --git a/app/views/account/settings/show.html.erb b/app/views/account/settings/show.html.erb index 53533bba4..7e2dbbfbf 100644 --- a/app/views/account/settings/show.html.erb +++ b/app/views/account/settings/show.html.erb @@ -10,5 +10,5 @@ <%= render "account/settings/users", users: @users %> - <%= render "account/settings/entropy_configuration", account: @account %> + <%= render "account/settings/entropy", account: @account %> diff --git a/app/views/collections/edit/_auto_close.html.erb b/app/views/collections/edit/_auto_close.html.erb index fba5f8771..4a86005a8 100644 --- a/app/views/collections/edit/_auto_close.html.erb +++ b/app/views/collections/edit/_auto_close.html.erb @@ -1,7 +1,7 @@ -<%= turbo_frame_tag @collection, :entropy_configuration do %> +<%= turbo_frame_tag @collection, :entropy do %>

Auto close

BOXCAR doesn’t let stale cards stick around forever. Cards automatically close as “Not now” if no one updates, comments, or moves a card for…

- <%= render "entropy/auto_close", model: collection, url: collection_entropy_configuration_path(collection) %> + <%= render "entropy/auto_close", model: collection, url: collection_entropy_path(collection) %>
<% end %> diff --git a/config/routes.rb b/config/routes.rb index 9b7e1ddb6..b8c481b53 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ Rails.application.routes.draw do post :enter, to: "entries#create" resource :join_code resource :settings - resource :entropy_configuration + resource :entropy end resources :users do @@ -16,7 +16,7 @@ Rails.application.routes.draw do resource :subscriptions resource :involvement resource :publication - resource :entropy_configuration + resource :entropy namespace :columns do resource :not_now diff --git a/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb b/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb new file mode 100644 index 000000000..2e1e5d1e8 --- /dev/null +++ b/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb @@ -0,0 +1,5 @@ +class RenameEntropyConfigurationsToEntropies < ActiveRecord::Migration[8.2] + def change + rename_table :entropy_configurations, :entropies + end +end diff --git a/db/schema.rb b/db/schema.rb index 987f8eb9d..3a6bf3b4c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.2].define(version: 2025_10_29_161222) do +ActiveRecord::Schema[8.2].define(version: 2025_11_02_115338) do create_table "accesses", force: :cascade do |t| t.datetime "accessed_at" t.integer "collection_id", null: false @@ -220,13 +220,13 @@ ActiveRecord::Schema[8.2].define(version: 2025_10_29_161222) do t.index ["filter_id"], name: "index_creators_filters_on_filter_id" end - create_table "entropy_configurations", force: :cascade do |t| + create_table "entropies", force: :cascade do |t| t.bigint "auto_postpone_period", default: 2592000, null: false t.integer "container_id", null: false t.string "container_type", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["container_type", "container_id", "auto_postpone_period"], name: "idx_on_container_type_container_id_auto_postpone_pe_47f82c5b73" + t.index ["container_type", "container_id", "auto_postpone_period"], name: "idx_on_container_type_container_id_auto_postpone_pe_3d79b50517" t.index ["container_type", "container_id"], name: "index_entropy_configurations_on_container", unique: true end diff --git a/db/schema_cache.yml b/db/schema_cache.yml index 704ed83a2..755b7cf07 100644 --- a/db/schema_cache.yml +++ b/db/schema_cache.yml @@ -606,7 +606,7 @@ columns: creators_filters: - *25 - *19 - entropy_configurations: + entropies: - !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column auto_increment: name: auto_postpone_period @@ -1254,7 +1254,7 @@ primary_keys: columns: id comments: id creators_filters: - entropy_configurations: id + entropies: id events: id filters: id filters_tags: @@ -1301,7 +1301,7 @@ data_sources: columns: true comments: true creators_filters: true - entropy_configurations: true + entropies: true events: true filters: true filters_tags: true @@ -2031,10 +2031,10 @@ indexes: nulls_not_distinct: comment: valid: true - entropy_configurations: + entropies: - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition - table: entropy_configurations - name: idx_on_container_type_container_id_auto_postpone_pe_47f82c5b73 + table: entropies + name: idx_on_container_type_container_id_auto_postpone_pe_3d79b50517 unique: false columns: - container_type @@ -2051,7 +2051,7 @@ indexes: comment: valid: true - !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition - table: entropy_configurations + table: entropies name: index_entropy_configurations_on_container unique: true columns: @@ -2879,4 +2879,4 @@ indexes: nulls_not_distinct: comment: valid: true -version: 20251029161222 +version: 20251102115338 diff --git a/test/controllers/accounts/entropies_controller_test.rb b/test/controllers/accounts/entropies_controller_test.rb new file mode 100644 index 000000000..9fda2c1ed --- /dev/null +++ b/test/controllers/accounts/entropies_controller_test.rb @@ -0,0 +1,15 @@ +require "test_helper" + +class Account::EntropiesControllerTest < ActionDispatch::IntegrationTest + setup do + sign_in_as :kevin + end + + test "update" do + put account_entropy_path, params: { entropy: { auto_postpone_period: 1.day } } + + assert_equal 1.day, entropies("37s_account").auto_postpone_period + + assert_redirected_to account_settings_path + end +end diff --git a/test/controllers/accounts/entropy_configurations_controller_test.rb b/test/controllers/accounts/entropy_configurations_controller_test.rb deleted file mode 100644 index 309e6712e..000000000 --- a/test/controllers/accounts/entropy_configurations_controller_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require "test_helper" - -class Account::EntropyConfigurationsControllerTest < ActionDispatch::IntegrationTest - setup do - sign_in_as :kevin - end - - test "update" do - put account_entropy_configuration_path, params: { entropy_configuration: { auto_postpone_period: 1.day } } - - assert_equal 1.day, entropy_configurations("37s_account").auto_postpone_period - - assert_redirected_to account_settings_path - end -end diff --git a/test/controllers/collections/entropies_controller_test.rb b/test/controllers/collections/entropies_controller_test.rb new file mode 100644 index 000000000..118ba0b7c --- /dev/null +++ b/test/controllers/collections/entropies_controller_test.rb @@ -0,0 +1,16 @@ +require "test_helper" + +class Collections::EntropiesControllerTest < ActionDispatch::IntegrationTest + setup do + sign_in_as :kevin + @collection = collections(:writebook) + end + + test "update" do + put collection_entropy_path(@collection), params: { collection: { auto_postpone_period: 1.day } } + + assert_equal 1.day, @collection.entropy.reload.auto_postpone_period + + assert_turbo_stream action: :replace, target: dom_id(@collection, :entropy) + end +end diff --git a/test/controllers/collections/entropy_configurations_controller_test.rb b/test/controllers/collections/entropy_configurations_controller_test.rb deleted file mode 100644 index 3fc24fe8a..000000000 --- a/test/controllers/collections/entropy_configurations_controller_test.rb +++ /dev/null @@ -1,16 +0,0 @@ -require "test_helper" - -class Collections::EntropyConfigurationsControllerTest < ActionDispatch::IntegrationTest - setup do - sign_in_as :kevin - @collection = collections(:writebook) - end - - test "update" do - put collection_entropy_configuration_path(@collection), params: { collection: { auto_postpone_period: 1.day } } - - assert_equal 1.day, @collection.entropy_configuration.reload.auto_postpone_period - - assert_turbo_stream action: :replace, target: dom_id(@collection, :entropy_configuration) - end -end diff --git a/test/controllers/collections_controller_test.rb b/test/controllers/collections_controller_test.rb index 4193cbbdd..92bb2237c 100644 --- a/test/controllers/collections_controller_test.rb +++ b/test/controllers/collections_controller_test.rb @@ -44,7 +44,7 @@ class CollectionsControllerTest < ActionDispatch::IntegrationTest assert_redirected_to edit_collection_path(collections(:writebook)) assert_equal "Writebook bugs", collections(:writebook).reload.name assert_equal users(:kevin, :jz).sort, collections(:writebook).users.sort - assert_equal 1.day, entropy_configurations(:writebook_collection).auto_postpone_period + assert_equal 1.day, entropies(:writebook_collection).auto_postpone_period assert_not collections(:writebook).all_access? end diff --git a/test/fixtures/entropy/configurations.yml b/test/fixtures/entropies.yml similarity index 100% rename from test/fixtures/entropy/configurations.yml rename to test/fixtures/entropies.yml diff --git a/test/models/card/entropic_test.rb b/test/models/card/entropic_test.rb index 4953ee24e..0512b1c2b 100644 --- a/test/models/card/entropic_test.rb +++ b/test/models/card/entropic_test.rb @@ -8,8 +8,8 @@ class Card::EntropicTest < ActiveSupport::TestCase test "auto_postpone_at uses the period defined in the account by default" do freeze_time - entropy_configurations(:writebook_collection).destroy - entropy_configurations("37s_account").reload.update! auto_postpone_period: 456.days + entropies(:writebook_collection).destroy + entropies("37s_account").reload.update! auto_postpone_period: 456.days cards(:layout).update! last_active_at: 2.day.ago assert_equal (456 - 2).days.from_now, cards(:layout).entropy.auto_clean_at end @@ -17,16 +17,16 @@ class Card::EntropicTest < ActiveSupport::TestCase test "auto_postpone_at infers the period from the collection when present" do freeze_time - entropy_configurations(:writebook_collection).update! auto_postpone_period: 123.days + entropies(:writebook_collection).update! auto_postpone_period: 123.days cards(:layout).update! last_active_at: 2.day.ago assert_equal (123 - 2).days.from_now, cards(:layout).entropy.auto_clean_at end - test "auto postpone all due using the default account entropy configuration" do - entropy_configurations(:writebook_collection).destroy + test "auto postpone all due using the default account entropy" do + entropies(:writebook_collection).destroy - cards(:logo).update!(last_active_at: 1.day.ago - entropy_configurations("37s_account").auto_postpone_period) - cards(:shipping).update!(last_active_at: 1.day.from_now - entropy_configurations("37s_account").auto_postpone_period) + cards(:logo).update!(last_active_at: 1.day.ago - entropies("37s_account").auto_postpone_period) + cards(:shipping).update!(last_active_at: 1.day.from_now - entropies("37s_account").auto_postpone_period) assert_difference -> { Card.postponed.count }, +1 do Card.auto_postpone_all_due @@ -37,9 +37,9 @@ class Card::EntropicTest < ActiveSupport::TestCase assert_not cards(:shipping).reload.postponed? end - test "auto postpone all due using entropy configuration defined at the collection level" do - cards(:logo).update!(last_active_at: 1.day.ago - entropy_configurations(:writebook_collection).auto_postpone_period) - cards(:shipping).update!(last_active_at: 1.day.from_now - entropy_configurations(:writebook_collection).auto_postpone_period) + test "auto postpone all due using entropy defined at the collection level" do + cards(:logo).update!(last_active_at: 1.day.ago - entropies(:writebook_collection).auto_postpone_period) + cards(:shipping).update!(last_active_at: 1.day.from_now - entropies(:writebook_collection).auto_postpone_period) assert_difference -> { Card.postponed.count }, +1 do Card.auto_postpone_all_due @@ -52,8 +52,8 @@ class Card::EntropicTest < ActiveSupport::TestCase test "postponing soon scope" do cards(:logo, :shipping).each(&:published!) - cards(:logo).update!(last_active_at: entropy_configurations(:writebook_collection).auto_postpone_period.seconds.ago + 2.days) - cards(:shipping).update!(last_active_at: entropy_configurations(:writebook_collection).auto_postpone_period.seconds.ago - 2.days) + cards(:logo).update!(last_active_at: entropies(:writebook_collection).auto_postpone_period.seconds.ago + 2.days) + cards(:shipping).update!(last_active_at: entropies(:writebook_collection).auto_postpone_period.seconds.ago - 2.days) assert_includes Card.postponing_soon, cards(:logo) assert_not_includes Card.postponing_soon, cards(:shipping) diff --git a/test/models/card/stallable_test.rb b/test/models/card/stallable_test.rb index a76ff1d69..13ae49972 100644 --- a/test/models/card/stallable_test.rb +++ b/test/models/card/stallable_test.rb @@ -28,7 +28,7 @@ class Card::StallableTest < ActiveSupport::TestCase test "a card with an old activity spike is not stalled after being postponed" do card = cards(:logo) - card.update!(last_active_at: 1.day.ago - card.collection.entropy_configuration.auto_postpone_period) + card.update!(last_active_at: 1.day.ago - card.collection.entropy.auto_postpone_period) card.create_activity_spike!(updated_at: 3.months.ago) assert card.stalled? diff --git a/test/models/entropy/configuration_test.rb b/test/models/entropy/configuration_test.rb deleted file mode 100644 index 015e8b1de..000000000 --- a/test/models/entropy/configuration_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -class Entropy::ConfigurationTest < ActiveSupport::TestCase - test "touch cards when configuration changes for collection container" do - collection = collections(:writebook) - config = collection.entropy_configuration || collection.create_entropy_configuration!(auto_postpone_period: 30.days) - - assert_enqueued_with(job: Card::TouchAllJob, args: [ collection ]) do - config.update!(auto_postpone_period: 15.days) - end - end - - test "touch cards when configuration changes for account container" do - account = Account.sole - - assert_enqueued_with(job: Card::TouchAllJob, args: [ account ]) do - account.default_entropy_configuration.update!(auto_postpone_period: 45.days) - end - end -end diff --git a/test/models/entropy_test.rb b/test/models/entropy_test.rb new file mode 100644 index 000000000..08fbf8600 --- /dev/null +++ b/test/models/entropy_test.rb @@ -0,0 +1,20 @@ +require "test_helper" + +class Entropy::Test < ActiveSupport::TestCase + test "touch cards when entropy changes for collection container" do + collection = collections(:writebook) + config = collection.entropy || collection.create_entropy!(auto_postpone_period: 30.days) + + assert_enqueued_with(job: Card::TouchAllJob, args: [ collection ]) do + config.update!(auto_postpone_period: 15.days) + end + end + + test "touch cards when entropy changes for account container" do + account = Account.sole + + assert_enqueued_with(job: Card::TouchAllJob, args: [ account ]) do + account.default_entropy.update!(auto_postpone_period: 45.days) + end + end +end diff --git a/test/routes_test.rb b/test/routes_test.rb index d1663037b..1bdc1ae5c 100644 --- a/test/routes_test.rb +++ b/test/routes_test.rb @@ -9,7 +9,7 @@ class RouteTest < ActionDispatch::IntegrationTest assert_recognizes({ controller: "account/settings", action: "show" }, "/account/settings") end - test "account/entropy_configuration" do - assert_recognizes({ controller: "account/entropy_configurations", action: "show" }, "/account/entropy_configuration") + test "account/entropy" do + assert_recognizes({ controller: "account/entropies", action: "show" }, "/account/entropy") end end