Created
January 24, 2011 14:02
-
-
Save jonleighton/793243 to your computer and use it in GitHub Desktop.
Rack test problem
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
$ ruby rack_proxy.rb | |
Loaded suite rack_proxy | |
Started | |
E | |
Finished in 0.004785 seconds. | |
1) Error: | |
test_foo(AppTest): | |
NoMethodError: undefined method `closed?' for nil:NilClass | |
/home/turnip/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/http.rb:1069:in `begin_transport' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-proxy-0.3.4/lib/net_http_hacked.rb:50:in `begin_request_hacked' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-proxy-0.3.4/lib/rack/http_streaming_response.rb:52:in `response' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-proxy-0.3.4/lib/rack/http_streaming_response.rb:12:in `status' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-proxy-0.3.4/lib/rack/proxy.rb:45:in `perform_request' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-proxy-0.3.4/lib/rack/proxy.rb:11:in `call' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-test-0.5.7/lib/rack/mock_session.rb:30:in `request' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-test-0.5.7/lib/rack/test.rb:209:in `process_request' | |
/home/turnip/.rvm/gems/ruby-1.8.7-p330/gems/rack-test-0.5.7/lib/rack/test.rb:57:in `get' | |
rack_proxy.rb:22:in `test_foo' | |
1 tests, 0 assertions, 0 failures, 1 errors |
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 'rack' | |
require 'test/unit' | |
require 'rack/proxy' | |
require 'rack/test' | |
require 'fakeweb' | |
class App < Rack::Proxy | |
def rewrite_env(env) | |
env["HTTP_HOST"] = "example.com" | |
env | |
end | |
end | |
class AppTest < Test::Unit::TestCase | |
include Rack::Test::Methods | |
def app | |
App.new | |
end | |
def test_foo | |
get "/" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment