Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4541d03
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use 1.9.2@rack_fiber_pool_test_app --create |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
source :rubygems | ||
gem 'rack' | ||
gem 'rack-fiber_pool', :require => 'rack/fiber_pool' | ||
gem 'eventmachine' | ||
gem 'em-http-request' | ||
gem 'em-synchrony' | ||
gem 'thin' | ||
|
||
group :test do | ||
gem 'rack-test', :require => 'rack/test' | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
addressable (2.2.4) | ||
daemons (1.1.2) | ||
em-http-request (0.3.0) | ||
addressable (>= 2.0.0) | ||
escape_utils | ||
eventmachine (>= 0.12.9) | ||
em-synchrony (0.2.0) | ||
eventmachine (>= 0.12.9) | ||
escape_utils (0.2.3) | ||
eventmachine (0.12.10) | ||
rack (1.2.2) | ||
rack-fiber_pool (0.9.1) | ||
rack-test (0.5.6) | ||
rack (>= 1.0) | ||
thin (1.2.11) | ||
daemons (>= 1.0.9) | ||
eventmachine (>= 0.12.6) | ||
rack (>= 1.0.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
em-http-request | ||
em-synchrony | ||
eventmachine | ||
rack | ||
rack-fiber_pool | ||
rack-test | ||
thin |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require './test_app.rb' | ||
use Rack::FiberPool | ||
run TestApp |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require './test_app.rb' | ||
Bundler.require :test | ||
require 'minitest/autorun' | ||
|
||
describe TestApp do | ||
include Rack::Test::Methods | ||
def app; TestApp end | ||
|
||
describe 'any request' do | ||
it 'returns google.com with EM' do | ||
get '/get_google' | ||
last_response.status.must_equal 200 | ||
(last_response.body.length > 0).must_equal true | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Bundler.setup | ||
Bundler.require | ||
|
||
class TestApp | ||
def self.call(env) | ||
result = EM::Synchrony.sync EventMachine::HttpRequest.new('http://google.com').get | ||
[200, {"Content-Type" => "text/html"}, [result.response]] | ||
end | ||
end |