Sha256: f3eeb591eef9f753a611d52812111a859f251bbbda1b34e1314a55f2b300e920

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

module Sofa::TVRage

describe Season do
  describe "with 1 episode" do
    before do
      @info = Crack::XML.parse(File.read("spec/fixtures/tvrage/episode_list_one_season.xml"))["Show"]["Episodelist"]["Season"]
      @episodes = [Episode.new(@info["episode"])]
    end

    subject { Season.new(@info) }

    it "should have #no" do
      subject.no.should == "0"
    end

    it "should have episode" do
      subject.episodes.should == @episodes
      subject.episodes.size.should == 1
    end

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

    it "should not be #eql to season with different attributes" do
      other = Season.new(@info.merge("no" => "23"))
      subject.should_not == other
    end

    it "should not be #equal to season with same attributes" do
      other = Season.new(@info)
      subject.should_not equal(other)
    end
  end
  
  describe "with 2 episodes" do
    before do
      @info = Crack::XML.parse(File.read("spec/fixtures/tvrage/episode_list_two_episodes.xml"))["Show"]["Episodelist"]["Season"]
      @episodes = []
      @info["episode"].each do |episode|
        @episodes << Episode.new(episode)
      end
    end

    subject { Season.new(@info) }

    it "should have #no" do
      subject.no.should == "1"
    end

    it "should have episodes" do
      subject.episodes.should == @episodes
      subject.episodes.size.should == 2
    end
  end
end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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