Sha256: 2f4610fa6f024ecc874c1249dac31bcbecd6852e301be7ca07f713abcb12ea0c
Contents?: true
Size: 1.97 KB
Versions: 2
Compression:
Stored size: 1.97 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe Zelda::Serie do describe "when retrieving a list of series" do it "should call Zelda with the correct url" do Zelda::Request.should_receive(:get).with("series") Zelda::Serie.all end end describe "when retrieving a specific serie" do before(:each) do serie_attrs = { "serie" => {"serieid" => "POW_00243538", "name" => "3 op reis"} } Zelda::Request.stub!(:get).with("series/1").and_return serie_attrs @aflevering = mock("Aflevering") Zelda::Aflevering.stub!(:new).and_return @aflevering end def find_serie Zelda::Serie.find(1) end it "should call Zelda with the correct url" do Zelda::Request.should_receive(:get).with("series/1") find_serie end it "should return a new Zender" do find_serie.should be_a(Zelda::Serie) end it "should send the correct request when asked for afleveringen" do serie = find_serie Zelda::Request.should_receive(:get).with("series/POW_00243538/afleveringen/").and_return("afleveringen" => ["foo"]) serie.afleveringen.should == [@aflevering] end it "should send the correct request when asked for upcoming afleveringen" do serie = find_serie Zelda::Request.should_receive(:get).with("series/POW_00243538/afleveringen/upcoming").and_return("afleveringen" => ["foo"]) serie.upcoming_afleveringen.should == [@aflevering] end it "should send the correct request when asked for past afleveringen" do serie = find_serie Zelda::Request.should_receive(:get).with("series/POW_00243538/afleveringen/past").and_return("afleveringen" => ["foo"]) serie.past_afleveringen.should == [@aflevering] end end it "should send the correct request when searching for series" do Zelda::Request.should_receive(:get).with("series/search/foo").and_return("series" => ["foo"]) Zelda::Serie.search("foo").should == ["foo"] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bartzon-zelda-0.0.2 | spec/zelda/serie_spec.rb |
bartzon-zelda-0.0.3 | spec/zelda/serie_spec.rb |