Sha256: ccb6ed168cf0a8a8b151e5ab14e28221898bcbc092df7d72308c3e9149cc0622

Contents?: true

Size: 1.69 KB

Versions: 5

Compression:

Stored size: 1.69 KB

Contents

require "spec_helper"

describe NPR::Entity::Member do
  json_fixture do
    <<-JSON
      {
        "id": "166481250",
        "promoArt": {
          "refId": "153611356",
          "num": "1"
        },
        "title": {
          "num": "2",
          "$text": "2312"
        },
        "author": {
          "id": "139197905",
          "num": "3",
          "title": {
            "$text": "Kim Stanley Robinson"
          },
          "link": {
            "type": "api",
            "$text": "http://api.npr.org/query?id=139197905&apiKey=MDA1OTI3MjQ5MDEyODUwMTE2MzM1YzNmZA004"
          }
        },
        "bookEdition": {
          "refId": "153611349",
          "num": "4"
        },
        "introText": {
          "num": "5",
          "$text": "<p>A sweeping space opera, <em>2312</em> is about what happens to humanity once we've truly conquered the solar system. Humans have colonized most of the planets and moons in our local volume of space, and it's the end of an interplanetary age of exploration. Political powers are consolidating their territories.</p>"
        },
        "byline": {
          "refId": "166481286",
          "num": "6"
        }
      }
    JSON
  end

  before :each do
    @member = NPR::Entity::Member.new(@fixture)
  end

  it "sets up attributes" do
    @member.id.should eq 166481250
  end

  it "sets up relations" do
    @member.promoArt.should be_a NPR::Entity::MemberPromoArt
    @member.title.should be_a NPR::Entity::Title
    @member.author.should be_a NPR::Entity::Author
    @member.bookEdition.should be_a NPR::Entity::PromoArtBookEdition
    @member.introText.should be_a NPR::Entity::IntroText
    @member.byline.should be_a NPR::Entity::MemberByline
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
npr-3.0.0 spec/unit/entity/member_spec.rb
npr-2.0.2 spec/unit/entity/member_spec.rb
npr-2.0.1 spec/unit/entity/member_spec.rb
npr-2.0.0 spec/unit/entity/member_spec.rb
npr-1.2.0 spec/unit/entity/member_spec.rb