Created
February 11, 2016 14:33
-
-
Save rubys/ed36247f96768ab30d57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gorp/test' | |
class LiveHang < Gorp::TestCase | |
test "including ActionController::Live" do | |
overview <<-EOF | |
Any attempt to use ActionController::Live causes all requests to hang | |
EOF | |
rails 'demo' | |
desc 'Create a model', id: 'create_model' | |
generate 'scaffold Company name:string' | |
desc 'Run the migration' | |
db :migrate | |
restart_server | |
desc 'Create something to look at', id: 'create_company' | |
post '/companies/new', 'company[name]' => 'ACME' | |
desc 'Fetch the companies in JSON format' | |
cmd 'curl --max-time 15 http://localhost:3000/companies.json' | |
desc "Include ActionController::Live" | |
edit 'app/controllers/companies_controller.rb' do | |
msub /class.*\n()/, " include ActionController::Live\n" | |
end | |
desc 'Try the fetch again' | |
cmd 'curl --max-time 15 http://localhost:3000/companies.json' do | |
assert_select '.stdout', /ACME/ | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment