Sha256: 7305b41f69bfd26afc73e25fae37a8908006c75cc0f25630d7ae3db2d1b0c943

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require './spec/spec_helper'

describe Photo do
  before(:each) do
    @photo = Photo.new({
      "ResourceUri" => "/listings/20100815153524571646000000/photos/20101124153422574618000000",
      "Id"          => "20101124153422574618000000",
      "Name"        => "Photo 1 name",
      "Caption"     => "caption here",
      "UriThumb"    => "http://photos.cdn.flexmls.com/xyz-t.jpg",
      "Uri300"      => "http://photos.cdn.flexmls.com/xyz.jpg",
      "Uri640"      => "http://cdn.resize.flexmls.com/az/640x480/true/20101124153422574618000000-o.jpg",
      "Uri800"      => "http://cdn.resize.flexmls.com/az/800x600/true/20101124153422574618000000-o.jpg",
      "Uri1024"     => "http://cdn.resize.flexmls.com/az/1024x768/true/20101124153422574618000000-o.jpg",
      "Uri1280"     => "http://cdn.resize.flexmls.com/az/1280x1024/true/20101124153422574618000000-o.jpg",
      "UriLarge"    => "http://photos.cdn.flexmls.com/xyz-o.jpg",
      "Primary"     => true
    })

  end

  it "responds to" do
    @photo.should respond_to(:primary?)
    Photo.should respond_to(:find_by_listing_key)
  end

  it "knows if it's the primary photo" do
    @photo.primary?.should be_true
    @photo.Primary = false
    @photo.primary?.should be_false
  end

  describe "find photos by listing id"  do
    before do
      stub_auth_request
      stub_api_get('/listings/1234/photos', 'listing_photos_index.json')
    end

    it "should get an array of photos" do
      p = Photo.find_by_listing_key('1234')
      p.should be_an(Array)
    end
  end

  after(:each) do  
    @photo = nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flexmls_api-0.6.5 spec/unit/flexmls_api/models/photo_spec.rb
flexmls_api-0.6.4 spec/unit/flexmls_api/models/photo_spec.rb