Sha256: 53d266dc5811fec9f9fa40a4e0a0ea01c2b1ea9afcfb2eb57d7f472f3a5d5da4

Contents?: true

Size: 834 Bytes

Versions: 13

Compression:

Stored size: 834 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require 'yajl/http_stream'
require 'socket'

describe "Passing options to HttpStream instance methods" do
  before(:all) do
    @stream = Yajl::HttpStream.new
  end

  it "should not create a new socket it one is provided" do
    expect(TCPSocket).not_to receive(:new)
    options = {:socket => :my_provided_socket}

    @stream.send(:initialize_socket, URI.parse("http://google.com"), options)

    expect(options[:socket]).to eq(:my_provided_socket)
  end

  it "should create a new socket if one is not provided" do
    expect(TCPSocket).to receive(:new).with("google.com", 80).and_return( :tcp_socket )
    options = {}

    @stream.send(:initialize_socket, URI.parse("http://google.com"), options)

    expect(options[:socket]).to eq(:tcp_socket)
  end
end

Version data entries

13 entries across 13 versions & 6 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_stream_options_spec.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_stream_options_spec.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_stream_options_spec.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/spec/http/http_stream_options_spec.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/yajl-ruby-1.4.3/spec/http/http_stream_options_spec.rb
yajl-ruby-1.4.3 spec/http/http_stream_options_spec.rb
yajl-ruby-1.4.2 spec/http/http_stream_options_spec.rb
yajl-ruby-1.4.1 spec/http/http_stream_options_spec.rb
yajl-ruby-1.4.0 spec/http/http_stream_options_spec.rb
yajl-ruby-1.3.1 spec/http/http_stream_options_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/spec/http/http_stream_options_spec.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/spec/http/http_stream_options_spec.rb
yajl-ruby-1.3.0 spec/http/http_stream_options_spec.rb