class BaseRequestTest
Public Instance Methods
setup()
click to toggle source
# File actionpack/test/dispatch/request_test.rb, line 6 def setup @env = { :ip_spoofing_check => true, "rack.input" => "foo" } @original_tld_length = ActionDispatch::Http::URL.tld_length end
teardown()
click to toggle source
# File actionpack/test/dispatch/request_test.rb, line 14 def teardown ActionDispatch::Http::URL.tld_length = @original_tld_length end
url_for(options = {})
click to toggle source
# File actionpack/test/dispatch/request_test.rb, line 18 def url_for(options = {}) options = { host: "www.example.com" }.merge!(options) ActionDispatch::Http::URL.url_for(options) end
Private Instance Methods
stub_request(env = {})
click to toggle source
# File actionpack/test/dispatch/request_test.rb, line 24 def stub_request(env = {}) ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true @trusted_proxies ||= nil ip_app = ActionDispatch::RemoteIp.new(Proc.new {}, ip_spoofing_check, @trusted_proxies) ActionDispatch::Http::URL.tld_length = env.delete(:tld_length) if env.key?(:tld_length) ip_app.call(env) env = @env.merge(env) ActionDispatch::Request.new(env) end