Sha256: 4a95800eee92d2c57045a653e426ac6acd6cccb0c41ceab1ea76c0a2e02a516f

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

describe RedisRing::SlaveRPC do

  before(:each) do
    @http_client = FakeHttpClient.new
    @host = "example.com"
    @port = 666
    @rpc = RedisRing::SlaveRPC.new(@http_client).connection(@host, @port)
  end

  describe :join do
    it "should post to joined url" do
      @rpc.join

      @http_client.sent_post?("http://example.com:666/slave/join").should be_true
    end
  end

  describe :status do
    it "should get and parse status" do
      @http_client.set_response("http://example.com:666/slave/status", {"parsed" => "yes"}.to_json)
      result = @rpc.status

      @http_client.sent_get?("http://example.com:666/slave/status").should be_true
      result.should == {"parsed" => "yes"}
    end
  end

  describe :start_shard do
    it "should get and parse status" do
      @rpc.start_shard(1)

      @http_client.sent_post?("http://example.com:666/slave/start_shard/1").should be_true
    end
  end

  describe :stop_shard do
    it "should get and parse status" do
      @rpc.stop_shard(1)

      @http_client.sent_post?("http://example.com:666/slave/stop_shard/1").should be_true
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_ring-0.1.3 spec/redis_ring/slave_rpc_spec.rb
redis_ring-0.1.2 spec/redis_ring/slave_rpc_spec.rb
redis_ring-0.1.1 spec/redis_ring/slave_rpc_spec.rb
redis_ring-0.1.0 spec/redis_ring/slave_rpc_spec.rb