Sha256: d92580c73ced99652b40fb0a40decdf42a7308e89a4ebc8f082d36d305ea2cb4

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 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))
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strong_json-0.1.2 spec/json_spec.rb
strong_json-0.1.1 spec/json_spec.rb
strong_json-0.1.0 spec/json_spec.rb