zeke (owner)

Fork Of

Revisions

gist: 215356 Download_button fork
public
Public Clone URL: git://gist.github.com/215356.git
Embed All Files: show embed
irb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[08:48 AM:gist-99771(master)] $ irb -rubygems -r myapp.rb -r rack/test
>> app = Rack::Test::Session.new(Sinatra::Application)
=> #<Rack::Test::Session:0x17e8820 @headers={}, @app=Sinatra::Application>
>> app.get '/'
 
=> #<Rack::Response:0x17ad4dc @block=nil, @writer=#<Proc:0x0189f7b4@/opt/local/lib/ruby/gems/1.8/gems/rack-0.9.1/lib/rack/response.rb:24>, header{"Content-Type"=>"text/html", "Content-Length"=>"7"}, body["testing"], length7, status200
 
>> app.body
NoMethodError: undefined method `body' for #<Rack::Test::Session:0x17e8820>
from (irb):3
 
>> app.last_response.body
=> ["testing"]
 
 
myapp.rb #
1
2
3
4
5
require 'sinatra'
 
get '/' do
  'testing'
end