Sha256: f9796182affcce54a2b84d16302f574df1d86584b10fb5e6d73d9ff8b8628a80

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

feature 'basic rails4 test' do

  before(:all) do
    configurator = Jubilee::Configuration.new(chdir: "#{apps_dir}/rails4/basic")
    @server = Jubilee::Server.new(nil, configurator.options)
    @server.start
    sleep 11
  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-2.0.0-java spec/integration/basic_rails4_spec.rb
jubilee-2.0.0.beta-java spec/integration/basic_rails4_spec.rb
jubilee-2.0.0.alpha1-java spec/integration/basic_rails4_spec.rb