Sha256: 372db98f1f19eec9d557a8a60f9e0d245bef1bf091364f126c171c0611e125d8

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

require "strong_json"

describe "StrongJSON.new" do
  it "tests the structure of a JSON object" do
    s = StrongJSON.new do
      let :item, object(name: string, count: numeric, price: numeric, comment: ignored)
      let :checkout, object(items: array(item), change: optional(number), type: enum(literal(1), symbol))
    end

    expect(s.checkout.coerce(items: [ { name: "test", count: 1, price: "2.33", comment: "dummy" }], type: 1)).to eq(items: [ { name: "test", count: 1, price: "2.33" }], type: 1)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
strong_json-0.6.0 spec/json_spec.rb
strong_json-0.5.0 spec/json_spec.rb
strong_json-0.4.0 spec/json_spec.rb
strong_json-0.3.0 spec/json_spec.rb
strong_json-0.2.0 spec/json_spec.rb