Sha256: e8f8ca83fe39fed3deae219f6d19369dea534b9dfbd42ef1b4a44f80ab13813d

Contents?: true

Size: 1.48 KB

Versions: 18

Compression:

Stored size: 1.48 KB

Contents

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

describe CobwebModule::Crawl, :local_only => true do
  include HttpStubs
  before(:each) do
    setup_stubs
    
    @local_redis = {:host => "localhost", :port => 6379}
    @remote_redis = {:host => "remote-redis", :port => 6379}
    
    @request = {:crawl_id => "test_crawl_id"}
  end

  describe "remote redis" do
    before(:each) do
      @local = CobwebModule::Crawl.new(:redis_options => @local_redis)
      @local.redis.del("test_redis")

      begin
        Resolv.getaddress @remote_redis[:host]
        @remote = CobwebModule::Crawl.new(:redis_options => @remote_redis)
        @remote.redis.del("test_redis")
      rescue
        @remote = nil
      end
      
    end
    it "should connect to the local redis" do
      if @remote
        @local.redis.exists("test_redis").should be_false
        @local.redis.set("test_redis", 1)
        @local.redis.exists("test_redis").should be_true

        @remote.redis.exists("test_redis").should be_false
      else
        puts "WARNING: can't connect to remote redis"
      end
    end
    it "should connect to the remote redis" do
      if @remote
        @remote.redis.exists("test_redis").should be_false
        @remote.redis.set("test_redis", 1)
        @remote.redis.exists("test_redis").should be_true
        
        @local.redis.exists("test_redis").should be_false
      else
        puts "WARNING: can't connect to remote redis"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cobweb-1.2.0 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.1.0 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.29 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.28 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.27 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.26 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.25 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.24 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.23 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.22 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.21 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.20 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.19 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.18 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.17 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.16 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.15 spec/cobweb/cobweb_crawl_spec.rb
cobweb-1.0.12 spec/cobweb/cobweb_crawl_spec.rb