summaryrefslogtreecommitdiff
path: root/spec/ffi_yajl
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-01-11 15:01:30 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-01-11 15:01:30 -0800
commit4b2c15cb8773e259c79af8eb51a81c093c8a04d1 (patch)
treedb8cab4b82f3faec8b667808cb0e45357c5e7b92 /spec/ffi_yajl
parent006775725816c5c50f51018940e23ed6f73d7e2f (diff)
downloadffi-yajl-4b2c15cb8773e259c79af8eb51a81c093c8a04d1.tar.gz
convert symbols to strings when encoding0.0.2
Diffstat (limited to 'spec/ffi_yajl')
-rw-r--r--spec/ffi_yajl/encoder_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ffi_yajl/encoder_spec.rb b/spec/ffi_yajl/encoder_spec.rb
index 2a7b102..443e987 100644
--- a/spec/ffi_yajl/encoder_spec.rb
+++ b/spec/ffi_yajl/encoder_spec.rb
@@ -35,5 +35,15 @@ describe "FFI_Yajl::Encoder" do
127.times {|_| a["a"] = {}; a = a["a"] }
expect{ encoder.encode(root) }.to raise_error(FFI_Yajl::EncodeError)
end
+
+ it "encodes symbols in keys as strings" do
+ ruby = {:thing => 1}
+ expect(encoder.encode(ruby)).to eq('{"thing":1}')
+ end
+
+ it "encodes symbols in values as strings" do
+ ruby = {"thing" => :one}
+ expect(encoder.encode(ruby)).to eq('{"thing":"one"}')
+ end
end