Sha256: ada382536696086fae514d2c185974cd2cc08e0e2f2b0ac797cdf4a3ac07679f

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

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

describe "Feed" do
  before :all do
    FakeWeb.register_uri(:get, "http://slashdot.org/index.rdf", :body => File.join(SPEC_DIR, 'supports', 'slashdot.xml'))
    
    @source = Smoke.feed(:slashdot) do
      url "http://slashdot.org/index.rdf"
      url "http://slashdot.org/index.rdf"
      
      emit do
        rename(:link => :url)
      end
    end
  end
  
  # it_should_behave_like "all sources"
  
  it "should have been activated" do
    Smoke[:slashdot].should(be_an_instance_of(Smoke::Feed))
  end
  
  it "should be a list of things" do
    Smoke[:slashdot].items.should be_an_instance_of(Array)
  end
  
  it "should respond to url" do
    Smoke[:slashdot].should respond_to(:url)
  end
  
  describe "after dispatch / query" do
    before do
      Smoke[:slashdot].output
    end
    
    it "should accept multiple urls" do
      Smoke[:slashdot].requests.should be_an_instance_of(Array)
    end
    
    it "should hold the url used to query" do
      Smoke[:slashdot].requests.collect{|r| r.uri }.should include("http://slashdot.org/index.rdf")
    end
    
    it "should have renamed url to link" do
      Smoke[:slashdot].output.first.should have_key(:url)
      Smoke[:slashdot].output.first.should_not have_key(:link)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smoke-0.5.20 spec/smoke/source/feed_spec.rb
smoke-0.5.19 spec/smoke/source/feed_spec.rb
smoke-0.5.17 spec/smoke/source/feed_spec.rb