spec/tracker_spec.rb in fastdfs-client-1.0.0 vs spec/tracker_spec.rb in fastdfs-client-1.0.1
- old
+ new
@@ -27,10 +27,21 @@
#[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 "get to the server failed" do
+ result = FC::ProtoCommon.header_bytes(FC::CMD::RESP_CODE, 0, 22)
+ MockTCPSocket.any_instance.stub("recv").and_return(result.pack("C*"))
+ expect(tracker.get_storage).to be_a_kind_of(Hash)
+ expect(tracker.get_storage[:status]).to be_falsey
+ end
+
it "run server flow" do
+ 1.times.map do
+ tracker.get_storage
+ end
+
# storage = tracker.get_storage
# puts "#{storage.host}, #{storage.port}"
# results = storage.upload(File.open("/Users/huxinghai/Documents/shark/app/assets/images/page.png"))
# puts results
# puts storage.delete(results[:path], results[:group_name])
\ No newline at end of file