Skip to content
Snippets Groups Projects
Commit 7858a176 authored by Ash McKenzie's avatar Ash McKenzie Committed by 🤖 GitLab Bot 🤖
Browse files

Merge branch '63510-error-parsing-true-boolean-in-gitlab-jsoncache' into 'master'

Gitlab::JsonCache#parse_value ensure string

Closes #63510

See merge request gitlab-org/gitlab-ce!29885

(cherry picked from commit 78869030)

03220c00 Gitlab::JsonCache#parse_value ensure string
parent cc00e2a7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,7 +58,7 @@ module Gitlab
private
 
def parse_value(raw, klass)
value = ActiveSupport::JSON.decode(raw)
value = ActiveSupport::JSON.decode(raw.to_s)
 
case value
when Hash then parse_entry(value, klass)
Loading
Loading
Loading
Loading
@@ -106,6 +106,16 @@ describe Gitlab::JsonCache do
expect(cache.read(key)).to be_nil
end
 
context 'when the cached value is a boolean' do
it 'parses the cached value' do
allow(backend).to receive(:read)
.with(expanded_key)
.and_return(true)
expect(cache.read(key, BroadcastMessage)).to eq(true)
end
end
context 'when the cached value is a hash' do
it 'parses the cached value' do
allow(backend).to receive(:read)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment