Sha256: 465c4c8ed3c031573109137a5550994a988914a8bf3e2f11efd91941f50136c7

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "spec_helper.rb")

describe "'Data' source" do
  before :all do
    FakeWeb.register_uri("http://photos.tld/index.json", :response => File.join(SPEC_DIR, 'supports', 'flickr-photo.json'))
    
    Smoke.data(:photos) do
      url "http://photos.tld/index.json"
      
      path :photos, :photo
    end
  end
  
  it "should have been activated" do
    Smoke[:photos].should(be_an_instance_of(Smoke::Source::Data))
  end
  
  it "should be a list of things" do
    Smoke[:photos].output.should be_an_instance_of(Array)
  end
  
  it "should respond to url" do
    Smoke[:photos].should respond_to(:url)
  end
  
  it "should hold the url used to query" do
    Smoke[:photos].request.uri.should == "http://photos.tld/index.json"
  end
  
  describe "results" do
    it "should have two items" do
      Smoke[:photos].output.size.should == 2
    end
    
    it "should be photo objects" do
      keys = [:ispublic, :title, :farm, :id, :isfamily, :server, :isfriend, :owner, :secret].each do |key|
        Smoke[:photos].output.first.should(have_key(key))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
benschwarz-smoke-0.3.4 spec/smoke/source/data_spec.rb
benschwarz-smoke-0.3.5 spec/smoke/source/data_spec.rb
benschwarz-smoke-0.3.6 spec/smoke/source/data_spec.rb
benschwarz-smoke-0.3.7 spec/smoke/source/data_spec.rb
benschwarz-smoke-0.3.9 spec/smoke/source/data_spec.rb