Commit 62c77617 authored by derek-knox's avatar derek-knox

Fix 'null' to null bug

parent a8c179ee
......@@ -47,6 +47,8 @@ class Projects::StaticSiteEditorController < Projects::ApplicationController
payload.transform_values do |value|
if value.is_a?(String) || value.is_a?(Integer)
value
elsif value.nil?
''
else
value.to_json
end
......
......@@ -105,7 +105,8 @@ RSpec.describe Projects::StaticSiteEditorController do
foo: 'bar'
}
},
a_boolean: true
a_boolean: true,
a_nil: nil
}
end
......@@ -130,6 +131,10 @@ RSpec.describe Projects::StaticSiteEditorController do
it 'serializes data values which are hashes to JSON' do
expect(assigns_data[:a_hash]).to eq('{"a_deeper_hash":{"foo":"bar"}}')
end
it 'serializes data values which are nil to an empty string' do
expect(assigns_data[:a_nil]).to eq('')
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment