0
0
Fork 0

Fix Lint/ConstantDefinitionInBlock cop (#24763)

This commit is contained in:
Matt Jankowski 2023-05-03 04:32:30 -04:00 committed by GitHub
parent 8b636a29c6
commit 3df665fd23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 120 additions and 118 deletions

View file

@ -223,14 +223,16 @@ describe ApplicationController, type: :controller do
end
describe 'cache_collection' do
class C < ApplicationController
public :cache_collection
subject do
Class.new(ApplicationController) do
public :cache_collection
end
end
shared_examples 'receives :with_includes' do |fabricator, klass|
it 'uses raw if it is not an ActiveRecord::Relation' do
record = Fabricate(fabricator)
expect(C.new.cache_collection([record], klass)).to eq [record]
expect(subject.new.cache_collection([record], klass)).to eq [record]
end
end
@ -241,13 +243,13 @@ describe ApplicationController, type: :controller do
record = Fabricate(fabricator)
relation = klass.none
allow(relation).to receive(:cache_ids).and_return([record])
expect(C.new.cache_collection(relation, klass)).to eq [record]
expect(subject.new.cache_collection(relation, klass)).to eq [record]
end
end
it 'returns raw unless class responds to :with_includes' do
raw = Object.new
expect(C.new.cache_collection(raw, Object)).to eq raw
expect(subject.new.cache_collection(raw, Object)).to eq raw
end
context 'Status' do