Commit a59c450c authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '270473-return-to-site-null-path' into 'master'

Fix 'null' to null bug

See merge request gitlab-org/gitlab!45720
parents 41e0a2ef 62c77617
...@@ -47,6 +47,8 @@ class Projects::StaticSiteEditorController < Projects::ApplicationController ...@@ -47,6 +47,8 @@ class Projects::StaticSiteEditorController < Projects::ApplicationController
payload.transform_values do |value| payload.transform_values do |value|
if value.is_a?(String) || value.is_a?(Integer) if value.is_a?(String) || value.is_a?(Integer)
value value
elsif value.nil?
''
else else
value.to_json value.to_json
end end
......
...@@ -105,7 +105,8 @@ RSpec.describe Projects::StaticSiteEditorController do ...@@ -105,7 +105,8 @@ RSpec.describe Projects::StaticSiteEditorController do
foo: 'bar' foo: 'bar'
} }
}, },
a_boolean: true a_boolean: true,
a_nil: nil
} }
end end
...@@ -130,6 +131,10 @@ RSpec.describe Projects::StaticSiteEditorController do ...@@ -130,6 +131,10 @@ RSpec.describe Projects::StaticSiteEditorController do
it 'serializes data values which are hashes to JSON' do it 'serializes data values which are hashes to JSON' do
expect(assigns_data[:a_hash]).to eq('{"a_deeper_hash":{"foo":"bar"}}') expect(assigns_data[:a_hash]).to eq('{"a_deeper_hash":{"foo":"bar"}}')
end end
it 'serializes data values which are nil to an empty string' do
expect(assigns_data[:a_nil]).to eq('')
end
end end
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