Skip to content

Instantly share code, notes, and snippets.

@nateberkopec
Created February 23, 2016 19:37
Show Gist options
  • Save nateberkopec/bc671b0dcc07917099c4 to your computer and use it in GitHub Desktop.
Save nateberkopec/bc671b0dcc07917099c4 to your computer and use it in GitHub Desktop.
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
end
require 'action_controller/railtie'
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: 'cookie_store_key'
secrets.secret_token = 'secret_token'
secrets.secret_key_base = 'secret_key_base'
config.logger = Logger.new($stdout)
Rails.logger = config.logger
routes.append do
root to: 'test#index'
end
end
STREAM_TEST_STRING = <<-EOF
Starting...
<% sleep(1) %>
1
<% sleep(1) %>
2
<% sleep(1) %>
3
<% sleep(1) %>
4
<% sleep(1) %>
5
<% sleep(1) %>
Done!
EOF
class TestController < ActionController::Base
def index
render inline: STREAM_TEST_STRING, stream: true
end
end
TestApp.initialize!
run TestApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment