Sha256: b892756ebdb149ffb96a1d4655c7dd4552cc38915793b445d86840ad7de8dc23

Contents?: true

Size: 1.67 KB

Versions: 33

Compression:

Stored size: 1.67 KB

Contents

#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

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

class ThriftHTTPClientTransportSpec < Spec::ExampleGroup
  include Thrift

  describe HTTPClientTransport do
    before(:each) do
      @client = HTTPClientTransport.new("http://my.domain.com/path/to/service")
    end

    it "should always be open" do
      @client.should be_open
      @client.close
      @client.should be_open
    end

    it "should post via HTTP and return the results" do
      @client.write "a test"
      @client.write " frame"
      Net::HTTP.should_receive(:new).with("my.domain.com", 80).and_return do
        mock("Net::HTTP").tee do |http|
          http.should_receive(:use_ssl=).with(false)
          http.should_receive(:post).with("/path/to/service", "a test frame", {"Content-Type"=>"application/x-thrift"}).and_return([nil, "data"])
        end
      end
      @client.flush
      @client.read(10).should == "data"
    end
  end
end

Version data entries

33 entries across 33 versions & 5 rubygems

Version Path
auser-poolparty-1.3.10 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.11 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.12 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.13 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.14 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.15 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.16 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.17 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.2 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.3 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.4 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.5 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.6 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.7 vendor/gems/thrift/spec/http_client_spec.rb
auser-poolparty-1.3.8 vendor/gems/thrift/spec/http_client_spec.rb
fairchild-poolparty-1.3.17 vendor/gems/thrift/spec/http_client_spec.rb
fairchild-poolparty-1.3.5 vendor/gems/thrift/spec/http_client_spec.rb
fl-thrift-0.0.1 spec/http_client_spec.rb
thrift-0.2.0.4 spec/http_client_spec.rb
thrift-0.2.0.3 spec/http_client_spec.rb