module Jpmobile::RackHelper

Public Instance Methods

init(c) click to toggle source
# File spec/rack_helper.rb, line 65
def init(c)
  @controller = c.new
  @controller.logger = Logger.new(nil)
  @request = ActionController::TestRequest.new
  @response = ActionController::TestResponse.new
  @request.host = "www.example.jp"
  @request.session.session_id = "mysessionid"
end
response_body(res) click to toggle source
# File spec/rack_helper.rb, line 75
def response_body(res)
  body = case res
         when Array
           res[2].body
         when String
           res.body
         else
           res.body
         end

  case body
  when Array
    body.first
  when String
    body
  else
    body
  end
end
user_agent(str) click to toggle source
# File spec/rack_helper.rb, line 62
def user_agent(str)
  @request.user_agent = str
end