Sha256: 918854f4fe08822a0795287d8431077d7d2e599d213775ddea6a53de83ce88cb
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe Medie::Json do before :all do full_json = IO.read(File.dirname(__FILE__) + '/full_json.js') @json = Medie::Json::Driver.new.unmarshal(full_json) end describe "JSON read" do it "should be able to read a JSON object in many ways" do @json["articles"]["link"].first["type"].should == "text/json" @json.articles.link.first.type.should == "text/json" @json.articles.links.search.href.should == "http://search.place.com" @json.articles.links.unknow_rel.should == nil end end describe "JSON write" do it "should be able to write a JSON object in many ways" do @json["articles"]["size"] = 10 @json["articles"]["size"].should == 10 @json.articles.link << {"href" => "http://dont.panic.com", "rel" => "towel"} @json.articles.link.last.href.should == "http://dont.panic.com" @json.articles.link.last.rel.should == "towel" @json.articles.link.size.should == 3 @json.articles.link.last.type = "application/json" @json.articles.link.last.type.should == "application/json" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
medie-1.0.0 | spec/integration/json_spec.rb |
medie-1.0.0.beta4 | spec/integration/json_spec.rb |
medie-1.0.0.beta3 | spec/integration/json_spec.rb |