Sha256: e9a8f36a12b14ea21c53963f75d26f7c4954ec3f03a584071eb17f39d6806587
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe Zelda::Omroep do before do @model = Zelda::Omroep.new(:foo => "bar") end it_should_behave_like 'a zelda base model' describe "when retrieving a list of omroepen" do it "should call Zelda with the correct url" do Zelda::Request.should_receive(:get).with("omroepen") Zelda::Omroep.all end end describe "when retrieving a specific omroep" do before(:each) do omroep_attrs = { "omroep" => {"slug" => "kro", "name" => "KRO"} } Zelda::Request.stub!(:get).with("omroepen/kro").and_return omroep_attrs end def find_omroep Zelda::Omroep.find('kro') end it "should call Zelda with the correct url" do Zelda::Request.should_receive(:get).with("omroepen/kro") find_omroep end it "should return a new Omroep" do find_omroep.should be_a(Zelda::Omroep) end it "should return nil if the omroep cannot be found" do Zelda::Request.stub!(:get).and_return nil find_omroep.should be_nil end it "should return the correct slug" do find_omroep.slug.should == "kro" end it "should return the correct name" do find_omroep.name.should == "KRO" end end describe "when retrieving the series for an omroep" do before(:each) do @omroep = Zelda::Omroep.new('slug' => 'kro') Zelda::Request.stub!(:get).and_return('omroep' => {'series' => {'serie' => [{'foo' => 'bar'}]}}) end def find_series @omroep.series end it "should call Zelda with the correct url" do Zelda::Request.should_receive(:get).with("omroepen/kro/series") find_series end it "should return an array of series" do find_series.first.should be_a(Zelda::Serie) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bartzon-zelda-0.0.5 | spec/zelda/omroep_spec.rb |