Sha256: 23678a43121b81a1af837334a1dcf5d6e7202feceef0eac36d1c2fa5243ac1ec

Contents?: true

Size: 1.73 KB

Versions: 4

Compression:

Stored size: 1.73 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Flickr::Photosets do
  before :all do
    @get_list_xml = File.read(File.dirname(__FILE__) +
        "/../fixtures/flickr/photosets/get_list-0.xml")
    @get_photos_xml = File.read(File.dirname(__FILE__) +
        "/../fixtures/flickr/photosets/get_photos-0.xml")
  end
    
  before :each do
    @flickr = SpecHelper.flickr
  end

  
  describe ".get_list" do
    it "should call flickr.photosets.getList" do
      @flickr.should_receive(:send_request).with("flickr.photosets.getList", {})       
      @flickr.photosets.get_list
    end
    
    it "should return an array of photoset objects" do
      @flickr.stub!(:request_over_http).and_return(@get_list_xml)  
      photosets = @flickr.photosets.get_list
      
      photosets[0].should be_an_instance_of(Flickr::Photosets::Photoset)      
      photosets[0].title.should == 'Test'
    end
  end
  
  describe ".get_photos" do
    before :each do
      @photoset = Flickr::Photosets::Photoset.new(@flickr,{:id=>4})
    end
    
    it "should call flickr.photosets.getPhotos" do
      @flickr.should_receive(:send_request).with("flickr.photosets.getPhotos",{:photoset_id=>4})       
      @photoset.get_photos
    end
    
    it "should return an array of photo objects" do
      @flickr.stub!(:request_over_http).and_return(@get_photos_xml)  
      photos = @photoset.get_photos
      
      photos.should_not be_nil
      photos[0].should be_an_instance_of(Flickr::Photos::Photo)    
    end
    
    it "should return the correct primary photo url" do
      @flickr.stub!(:request_over_http).and_return(@get_list_xml)
      @flickr.photosets.get_list[0].primary_photo_url.should == 'http://farm1.static.flickr.com/8/2483_abcdef_s.jpg'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ayn-flickr_fu-0.3.5 spec/flickr/photosets_spec.rb
ayn-flickr_fu-0.3.6 spec/flickr/photosets_spec.rb
ayn-flickr_fu-0.3.7 spec/flickr/photosets_spec.rb
ayn-flickr_fu-0.3.9 spec/flickr/photosets_spec.rb