spec/unit/entity/byline_spec.rb in npr-0.1.1 vs spec/unit/entity/byline_spec.rb in npr-0.1.2

- old
+ new

@@ -2,22 +2,39 @@ describe NPR::Entity::Byline do json_fixture do <<-JSON { - "id": "166481173", + "id": "166885535", "name": { - "$text": "Annalee Newitz" - } + "personId": "134991966", + "$text": "Julie Bierach" + }, + "link": [ + { + "type": "html", + "$text": "http://news.stlpublicradio.org/people/julie-bierach" + }, + { + "type": "api", + "$text": "http://api.npr.org/query?id=134991966&apiKey=MDA1OTI3MjQ5MDEyODUwMTE2MzM1YzNmZA004" + } + ] } JSON end before :each do @byline = NPR::Entity::Byline.new(@fixture) end it "sets up attributes" do - @byline.id.should eq 166481173 - @byline.name.should match /Annalee/ + @byline.id.should be_a Fixnum + @byline.id.should_not eq 0 + end + + it "creates relations" do + @byline.links.size.should eq 2 + @byline.links.first.should be_a NPR::Entity::Link + @byline.name.should be_a NPR::Entity::Name end end