Sha256: 485628eb62be4118846fc3a4769b92cb7991d0e4687970b446da347a7c2c958a

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

feature 'basic rails4 test' do

  before(:all) do
    configurator = Jubilee::Configuration.new(root: "#{apps_dir}/rails4/basic", instances: 1)
    @server = Jubilee::Server.new(configurator.options)
    q = Queue.new
    @server.start { q << 1 }
    q.pop
  end

  after(:all) do
    @server.stop
    sleep 0.1
  end

  it 'should do a basic get' do
    visit '/'
    page.should have_content('It works')
    page.find('#success')[:class].should == 'basic-rails4'
  end

  context 'streaming' do
    it "should work for small responses" do
      verify_streaming("/root/streaming?count=0")
    end

    it "should work for large responses" do
      verify_streaming("/root/streaming?count=500")
    end

    def verify_streaming(url)
      uri = URI.parse("#{Capybara.app_host}#{url}")
      Net::HTTP.get_response(uri) do |response|
        response.should be_chunked
        response.header['transfer-encoding'].should == 'chunked'
        chunk_count, body = 0, ""
        response.read_body do |chunk|
          chunk_count += 1
          body += chunk
        end
        body.should include('It works')
        body.each_line do |line|
          line.should_not match(/^\d+\s*$/)
        end
        chunk_count.should be > 1
      end
    end
  end

  it 'should return a static page beneath default public dir' do
    visit "/some_page.html"
    element = page.find('#success')
    element.should_not be_nil
    element.text.should == 'static page'
  end

  it "should support setting multiple cookies" do
    visit "/root/multiple_cookies"
    page.driver.cookies['foo1'].value.should == 'bar1'
    page.driver.cookies['foo2'].value.should == 'bar2'
    page.driver.cookies['foo3'].value.should == 'bar3'
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jubilee-3.0.0.beta2-java spec/integration/basic_rails4_spec.rb
jubilee-2.1.0.rc1-java spec/integration/basic_rails4_spec.rb
jubilee-2.1.0.beta-java spec/integration/basic_rails4_spec.rb