StreamingHelper doesn't seem to actually work #283

Open
kornypoet opened this Issue Feb 21, 2014 · 0 comments

Projects

None yet

1 participant

@kornypoet

Altering the included integration test does not cause the test to fail as expected:

# from spec/integration/chunked_streaming_spec.rb

require 'spec_helper'
require File.join(File.dirname(__FILE__), '../../', 'lib/goliath/test_helper_streaming')
require File.join(File.dirname(__FILE__), '../../', 'lib/goliath')

class ChunkedStreaming < Goliath::API

  def response(env)

    EM.next_tick do
      env.chunked_stream_send("ignored") # originally "chunked"
      env.chunked_stream_close
    end

    headers = { 'Content-Type' => 'text/plain', 'X-Stream' => 'Goliath' }
    chunked_streaming_response(200, headers)
  end

  def on_close(env)
  end
end

describe "ChunkedStreaming" do
  include Goliath::TestHelper

  let(:err) { Proc.new { |c| fail "HTTP Request failed #{c.response}" } }

  it "should stream content" do
    with_api(ChunkedStreaming, {:verbose => true, :log_stdout => true}) do |server|
      streaming_client_connect('/streaming') do |client|
        # this should raise an RSpec::ExpectationNotMet,
        # however this block is never actually called
        client.receive.should == "chunked"
      end
    end
  end
end

Running the above test (using bundle exec rspec spec/integration/chunked_streaming_spec.rb) incorrectly still passes, which leads me to believe the StreamingHelper itself is broken. This was checked against master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment