Class: RackBox::App

Inherits:
Object
  • Object
show all
Defined in:
lib/rackbox/app.rb

Overview

represents a rack appliction

gives us some helpers on a rack app like the ability to use the #request method on it easily

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rack_app) ⇒ App

Returns a new instance of App.



12
13
14
15
# File 'lib/rackbox/app.rb', line 12

def initialize rack_app
  @rack_app = rack_app
  reset_request
end

Instance Attribute Details

#mock_requestObject

Returns the value of attribute mock_request.



10
11
12
# File 'lib/rackbox/app.rb', line 10

def mock_request
  @mock_request
end

#rack_appObject

Returns the value of attribute rack_app.



10
11
12
# File 'lib/rackbox/app.rb', line 10

def rack_app
  @rack_app
end

Instance Method Details

#request(url, options = {}) ⇒ Object

sessions are sticky!

to reset, @rackbox_app.reset



25
26
27
# File 'lib/rackbox/app.rb', line 25

def request url, options = {}
  RackBox.request @mock_request, url, options
end

#reset_requestObject Also known as: reset



17
18
19
# File 'lib/rackbox/app.rb', line 17

def reset_request
  @mock_request = Rack::MockRequest.new @rack_app
end