Sha256: 1e1ebaf2b01d2c28c404dcd2b3d482a189346a58c7b7d547b10f0b7184f14d0a

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

require 'spidr/session_cache'

require 'spec_helper'

describe SessionCache do
  describe "empty" do
    before(:all) do
      @sessions = SessionCache.new
    end

    it "should not have any active sessions" do
      @sessions.should_not be_active(URI('http://example.com/'))
    end

    it "should start new sessions on-demand" do
      @sessions[URI('http://example.com/')].should_not be_nil
    end

    after(:all) do
      @sessions.clear
    end
  end

  describe "not-empty" do
    before(:all) do
      @url = URI('http://example.com/')

      @sessions = SessionCache.new
      @sessions[@url]
    end

    it "should have active sessions" do
      @sessions.should be_active(@url)
    end

    it "should provide access to sessions" do
      @sessions[@url].should_not be_nil
    end

    it "should start new sessions on-demand" do
      url2 = URI('http://www.w3c.org/')

      @sessions[url2].should_not be_nil
    end

    it "should be able to kill sessions" do
      url2 = URI('http://www.w3c.org/')

      @sessions[url2].should_not be_nil
      @sessions.kill!(url2)
      @sessions.should_not be_active(url2)
    end

    after(:all) do
      @sessions.clear
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
spidr_epg-1.0.0 spec/session_cache.rb
spidr-0.4.1 spec/session_cache.rb
spidr-0.4.0 spec/session_cache.rb
spidr-0.3.2 spec/session_cache.rb
spidr-0.3.1 spec/session_cache.rb
spidr-0.3.0 spec/session_cache.rb
spidr-0.2.7 spec/session_cache.rb
spidr-0.2.6 spec/session_cache.rb
spidr-0.2.5 spec/session_cache.rb
spidr-0.2.4 spec/session_cache.rb
spidr-0.2.3 spec/session_cache.rb