Sha256: 7f8307b759e70cc91f2206fa5e3342bd70b1bb089d7b33d8ec8db5c00549721a
Contents?: true
Size: 503 Bytes
Versions: 4
Compression:
Stored size: 503 Bytes
Contents
require 'spec_helper' module Kosher describe Struct do before(:all) do class Foo < Struct.new(:bar); end end describe "to_json" do it "converts to JSON" do foo = Foo.new foo.bar = 1 foo.to_json.should eql "{\"bar\":1}" end it "handles nested structs" do foo_1 = Foo.new foo_2 = Foo.new foo_2.bar = 1 foo_1.bar = foo_2 foo_1.to_json.should eql "{\"bar\":{\"bar\":1}}" end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
fassbinder-0.0.1 | spec/fassbinder/struct_spec.rb |
kosher-0.1.12 | spec/kosher/struct_spec.rb |
kosher-0.1.9 | spec/kosher/struct_spec.rb |
kosher-0.1.8 | spec/kosher/struct_spec.rb |