Do not modify standard symbol in JSON behaviour. It seems to be good now

This commit is contained in:
2025-09-23 12:56:42 -05:00
parent 6a100555bc
commit 6596693238
2 changed files with 16 additions and 10 deletions
+6 -1
View File
@@ -1,11 +1,16 @@
require 'spec_helper'
#TODO, is this really a good behaviour?
describe Symbol do
it 'to_json becomes a string in json format' do
:abc.to_json.should == 'abc'
:abc.to_json.should == '"abc"'
end
it 'as_json becomes a string in json format' do
:abc.as_json.should == 'abc'
end
it 'works in hashes' do
expect([{abc: :def}].to_json).to eq %|[{"abc":"def"}]|
end
end