Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamingHelper doesn't seem to actually work #283

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

StreamingHelper doesn't seem to actually work #283

kornypoet opened this issue Feb 21, 2014 · 0 comments

Comments

@kornypoet
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant