Rename cache_*
methods to preload_*
in controller concern (#30209)
This commit is contained in:
parent
f0d6dc4519
commit
65e82211cd
19 changed files with 56 additions and 54 deletions
|
@ -2,20 +2,20 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CacheConcern do
|
||||
RSpec.describe PreloadingConcern do
|
||||
controller(ApplicationController) do
|
||||
include CacheConcern
|
||||
include PreloadingConcern
|
||||
|
||||
def empty_array
|
||||
render plain: cache_collection([], Status).size
|
||||
render plain: preload_collection([], Status).size
|
||||
end
|
||||
|
||||
def empty_relation
|
||||
render plain: cache_collection(Status.none, Status).size
|
||||
render plain: preload_collection(Status.none, Status).size
|
||||
end
|
||||
|
||||
def account_statuses_favourites
|
||||
render plain: cache_collection(Status.where(account_id: params[:id]), Status).map(&:favourites_count)
|
||||
render plain: preload_collection(Status.where(account_id: params[:id]), Status).map(&:favourites_count)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +27,7 @@ RSpec.describe CacheConcern do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#cache_collection' do
|
||||
describe '#preload_collection' do
|
||||
context 'when given an empty array' do
|
||||
it 'returns an empty array' do
|
||||
get :empty_array
|
Loading…
Add table
Add a link
Reference in a new issue