Sha256: dbf37b6051d34f7fa79efb432198c8130bc8d8f1efb610687115fe17c3176ac6

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Fastdfs::Client::Tracker do 

  let(:host){ "192.168.9.16" }
  let(:port){ "22122" }

  let(:tracker){ FC::Tracker.new(host, port) }

  it "initialize the server" do 
    expect(FC::Socket).to receive(:new).with(host, port, nil) 
    FC::Tracker.new(host, port) 
  end

  it "should have access to the storage connection" do
    expect(tracker.socket).to receive(:connection)
    expect(tracker.socket).to receive(:close)
    tracker.get_storage
  end

  it "should have access to the storage class" do 
    expect(tracker.get_storage.class).to eq(FC::Storage)
  end

  it "verify the server address and port" do 
    expect(tracker.get_storage.host).to eq(TestConfig::STORAGE_IP)
    #[0, 0, 0, 0, 0, 89, 216, 0]
    expect(tracker.get_storage.port.to_s).to eq(TestConfig::STORAGE_PORT)
    expect(tracker.get_storage.store_path).to eq(TestConfig::STORE_PATH)
  end

  it "run server flow" do 
    # storage = tracker.get_storage
    # puts "#{storage.host}, #{storage.port}"
    # results = storage.upload(File.open("/Users/huxinghai/Documents/shark/app/assets/images/page.png"))
    # puts storage.delete(results[:path], results[:group_name])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastdfs-client-0.0.2 spec/tracker_spec.rb