def setup_rack_application(application, options = {}, mixpanel_options = {}) stub!(:app).and_return(Mixpanel::Middleware.new(application.new(options), MIX_PANEL_TOKEN, mixpanel_options)) end def html_document <<-EOT EOT end class DummyApp def initialize(options) @response_with = {} @response_with[:status] = options[:status] || "200" @response_with[:headers] = options[:headers] || {} @response_with[:body] = wrap(options[:body] || '') end def call(env) [@response_with[:status], @response_with[:headers], @response_with[:body]] end private def wrap(object) if object.nil? [] elsif object.respond_to?(:to_ary) object.to_ary || [object] else [object] end end end def large_script <<-EOT

Attach to memory for

EOT end