controller test broken: eval error: undefined method `keys' for nil:NilClass
Closed this issue · 3 comments
fwolfst commented
We have a pretty straight forward controller test that breaks execution
context 'with the user not logged in' do
context 'when the operation name contains "private"' do
it 'returns a 403' do
post :execute, as: :json, params: { query:, operationName: 'whatever-private' }
expect(response).to be_forbidden # < boom; and response.forbidden? is false
end
end
The exception bubble up from ruby/gems/3.2.0/gems/super_diff-0.10.0/lib/super_diff/object_inspection/inspection_tree.rb:72
in `insert_hash_inspection_of'.
jas14 commented
jas14 commented
I was able to reproduce with a very simple app and may have found the culprit: ActiveSupport::OrderedOptions
. This class specifically defines respond_to_missing?
as true
for everything. Thus, SuperDiff's InspectionTreeBuilders::CustomObject
will be mistakenly applied to OrderedOptions
, which will call insert_hash_inspection_of(nil)
, which will raise as described.