Sha256: 8f8d129e6487348eef732c675e2dea3d5698389f9f64c5e45752dd0f24535166

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

shared_examples_for 'an adapter' do |adapter|

  before{ OandaAPI::Streaming::JsonParser.use adapter }

  describe ".parse" do
    it "deserializes json using symbolized keys" do
      [
        ["{\"a\":[{\"b\":{\"3\":3}}]}", [{ :a => [:b => { :"3" => 3 }] }]],
        ["{\"a\":\"a\"} \r\n ", [{ :a => "a"}]],
        ["", []],
        ["   ", []],
        ["\r\n", []]
        
      ].each do |serialized, deserialized|
        expect(OandaAPI::Streaming::JsonParser.adapter.parse(serialized)).to eq(deserialized)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oanda_api-0.9.6 spec/shared/adapter.rb
oanda_api-0.9.5 spec/shared/adapter.rb
oanda_api-0.9.4 spec/shared/adapter.rb
oanda_api-0.9.3 spec/shared/adapter.rb
oanda_api-0.9.2 spec/shared/adapter.rb