Sha256: 88a5e32d750a083d48ad053ac630d946d0624e13706eaa8ee87387b4d193ffcb

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'spec_helper'
require 'rack/test'
require 'async_rack_test'

describe Firehose::Rack::PublisherApp, :type => :request do
  include AsyncRackTest::Methods
  let(:app) { Firehose::Rack::PublisherApp.new }
  let(:path) { "/test/path/#{Time.now.to_i}" }
  let(:deferrable) { EM::DefaultDeferrable.new }

  context 'publishing is successful' do
    before { deferrable.succeed }

    it "should return 202" do
      app.stub(:publisher => double('publisher', :publish => deferrable))
      aput path, :body => "some nice little message"
      last_response.status.should == 202
    end

    it "should have Content-Length of zero" do
      app.stub(:publisher => double('publisher', :publish => deferrable))
      aput path, :body => "some nice little message"
      last_response.headers['Content-Length'].should == '0'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
firehose-0.2.alpha.3 spec/lib/rack/publisher_app_spec.rb
firehose-0.2.alpha.2 spec/lib/rack/publisher_app_spec.rb