blob: f2c96b64ddfa5c7a84129ec7046cfa6b995dcff7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# encoding: UTF-8
require 'spec_helper'
describe "FFI_Yajl::Encoder" do
let(:encoder) { FFI_Yajl::Encoder.new }
it "encodes fixnums in keys as strings" do
ruby = {1 => 2}
expect(encoder.encode(ruby)).to eq('{"1":2}')
end
it "encodes floats in keys as strings" do
ruby = {1.1 => 2}
expect(encoder.encode(ruby)).to eq('{"1.1":2}')
end
it "encodes bignums in keys as strings" do
ruby = {12345678901234567890 => 2}
expect(encoder.encode(ruby)).to eq('{"12345678901234567890":2}')
end
end
|