Do not modify standard symbol in JSON behaviour. It seems to be good now
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
class Symbol
|
# #TODO: please investigate if this can be removed
|
||||||
def to_json(*)
|
# class Symbol
|
||||||
to_s
|
# def to_json(*)
|
||||||
end
|
# to_s
|
||||||
|
# end
|
||||||
def as_json(*)
|
#
|
||||||
to_s
|
# def as_json(*)
|
||||||
end
|
# to_s
|
||||||
end
|
# end
|
||||||
|
# end
|
||||||
|
|||||||
+6
-1
@@ -1,11 +1,16 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
#TODO, is this really a good behaviour?
|
||||||
describe Symbol do
|
describe Symbol do
|
||||||
it 'to_json becomes a string in json format' do
|
it 'to_json becomes a string in json format' do
|
||||||
:abc.to_json.should == 'abc'
|
:abc.to_json.should == '"abc"'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'as_json becomes a string in json format' do
|
it 'as_json becomes a string in json format' do
|
||||||
:abc.as_json.should == 'abc'
|
:abc.as_json.should == 'abc'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'works in hashes' do
|
||||||
|
expect([{abc: :def}].to_json).to eq %|[{"abc":"def"}]|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user