Sha256: 3033d32ed23ed3aa659bebcf3bd0b121a79a250bef26ac877216ef5e87def04b

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

describe NPR::Entity::Formats do
  json_fixture do
    <<-JSON
      {
        "mp3": [
          {
            "type": "mp3",
            "$text": "http://pd.npr.org/anon.npr-mp3/npr/totn/2012/12/20121214_totn_01.mp3?orgId=1&topicId=1007&ft=3&f="
          },
          {
            "type": "m3u",
            "$text": "http://api.npr.org/m3u/1167255688-5265f3.m3u?orgId=1&topicId=1007&ft=3&f="
          }
        ],
        "wm": {
          "$text": "http://www.npr.org/templates/dmg/dmg_wmref_em.php?id=167255688&type=1&mtype=WM&orgId=1&topicId=1007&ft=3&f="
        },
        "mediastream": {
          "$text": "rtmp://flash.npr.org/ondemand/mp3:anon.npr-mp3/npr/totn/2012/12/20121214_totn_01.mp3"
        }
      }
    JSON
  end

  before :each do
    @formats = NPR::Entity::Formats.new(@fixture)
  end

  it "sets up attributes" do
    @formats.wm.should match /npr\.org/
    @formats.rm.should eq nil
    @formats.mediastream.should match /flash/
  end

  it "creates relations" do
    @formats.mp3s.size.should eq 2
    @formats.mp3s.first.should be_a NPR::Entity::MP3
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
npr-1.2.0 spec/unit/entity/formats_spec.rb