Sha256: 98f9ade842a092df9750b08d68c4e0a3e8bca44fb32b5b88de203c0feb6759d8

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

module Sofa::TVRage

describe Episode do
  before do
    @info = Crack::XML.parse(File.read("spec/fixtures/tvrage/single_episode.xml"))["episode"]
  end

  subject { Episode.new(@info) }
 
  { :num        => "1",
    :num_in_season => "01",
    :prod_num   => "4V01",
    :air_date   => "1997-03-10",
    :link       => "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episodes/28077",
    :title      => "Welcome to the Hellmouth (1)"
  }.each do |attr, value|
    it "should get ##{attr}" do
      subject.send(attr).should == value
    end
  end

  it "should get episode info" do
    id='10' 
    season='1' 
    episode='04'

    @xml = File.read("spec/fixtures/tvrage/episode_info.xml")
    FakeWeb.register_uri(:get, "http://services.tvrage.com/feeds/episodeinfo.php?sid=#{id}&ep=#{season}x#{episode}", :body => @xml)

    Episode.info(id, season, episode).should == Crack::XML.parse(@xml)["show"]
  end

  it "should have season number" do
    subject.should respond_to(:season_num)
  end

  it "should be #eql to episode with same attributes" do
    other = Episode.new(@info)
    subject.should == other
  end

  it "should not be #eql to episode with different attributes" do
    other = Episode.new(@info.merge("epnum" => "4"))
    subject.num.should_not == other.num
    subject.should_not == other
  end

  it "should not be #equal to episode with same attributes" do
    other = Episode.new(@info)
    subject.should_not equal(other)
  end
end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sofa-0.1.4 spec/sofa/tvrage/episode_spec.rb
sofa-0.1.3 spec/sofa/tvrage/episode_spec.rb
sofa-0.1.2 spec/sofa/tvrage/episode_spec.rb
sofa-0.1.1 spec/sofa/tvrage/episode_spec.rb