Sha256: 5de76129a4134cec277f53655621a403dcffd89346d8c4b820c1053ff3a4bcc2
Contents?: true
Size: 589 Bytes
Versions: 1
Compression:
Stored size: 589 Bytes
Contents
p `pwd` require 'rspec' require './lib/json2json.rb' describe Json2Json do context "simple" do let(:a) { {a: 1, b: 2, c: {d: [1,2,3]}} } let(:template) { {p: "$.a", q: {r: "$.c.d"}} } specify { expect(Json2Json.transform(a, template)).to eq ({p: 1, q: {r: [1,2,3]}}) } end context "errors" do let(:a) { {a: 1, b: 2, c: {d: [1,2,3]}} } let(:template) { {p: "$.foo", q: {r: "$.bar.d"}} } specify { expect(Json2Json.transform(a, template)).to eq ({p: nil, q: {r: nil}}) } specify { expect(Json2Json.transform!(a, template)).to raise_error } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
json2json-0.0.1 | spec/lib/json2json_spec.rb |