Class: Web2Go::MockResponse
- Inherits:
-
Object
- Object
- Web2Go::MockResponse
- Defined in:
- lib/Web2Go/MockResponse.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#redirect_to ⇒ Object
Returns the value of attribute redirect_to.
Instance Method Summary collapse
- #add_cookie(name, value, domain = nil, path = nil, expires = nil) ⇒ Object
- #failed ⇒ Object
- #failed? ⇒ Boolean
-
#initialize ⇒ MockResponse
constructor
A new instance of MockResponse.
- #set_cookie(cookie) ⇒ Object
Constructor Details
#initialize ⇒ MockResponse
Returns a new instance of MockResponse.
14 15 16 17 18 |
# File 'lib/Web2Go/MockResponse.rb', line 14 def initialize @content_type = 'text/html' @cookies = { } @failed = false end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
9 10 11 |
# File 'lib/Web2Go/MockResponse.rb', line 9 def body @body end |
#content_type ⇒ Object
Returns the value of attribute content_type.
10 11 12 |
# File 'lib/Web2Go/MockResponse.rb', line 10 def content_type @content_type end |
#cookies ⇒ Object
Returns the value of attribute cookies.
12 13 14 |
# File 'lib/Web2Go/MockResponse.rb', line 12 def @cookies end |
#redirect_to ⇒ Object
Returns the value of attribute redirect_to.
11 12 13 |
# File 'lib/Web2Go/MockResponse.rb', line 11 def redirect_to @redirect_to end |
Instance Method Details
#add_cookie(name, value, domain = nil, path = nil, expires = nil) ⇒ Object
24 25 26 |
# File 'lib/Web2Go/MockResponse.rb', line 24 def (name,value,domain=nil,path=nil,expires=nil) @cookies[name] = MockCookie.new(name,value,domain,expires) end |
#failed ⇒ Object
28 29 30 |
# File 'lib/Web2Go/MockResponse.rb', line 28 def failed @failed = true end |
#failed? ⇒ Boolean
32 33 34 |
# File 'lib/Web2Go/MockResponse.rb', line 32 def failed? @failed end |
#set_cookie(cookie) ⇒ Object
20 21 22 |
# File 'lib/Web2Go/MockResponse.rb', line 20 def () @cookies[.name] = end |