Class: MockedHttpResponse
- Inherits:
-
Object
- Object
- MockedHttpResponse
- Includes:
- HttpServletResponse
- Defined in:
- lib/spec/vraptor/mocked_http_response.rb
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#error ⇒ Object
Returns the value of attribute error.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #add_cookie(cookie) ⇒ Object
- #add_header(name, value) ⇒ Object
- #destination ⇒ Object
-
#initialize ⇒ MockedHttpResponse
constructor
A new instance of MockedHttpResponse.
- #send_error(code, msg = '') ⇒ Object
- #send_redirect(path) ⇒ Object
- #set_status(x) ⇒ Object
Constructor Details
#initialize ⇒ MockedHttpResponse
Returns a new instance of MockedHttpResponse.
5 6 7 8 9 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 5 def initialize @status = 200 @headers = {} @cookies = Array.new end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
3 4 5 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 3 def @cookies end |
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 3 def error @error end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 3 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 3 def status @status end |
#target ⇒ Object
Returns the value of attribute target.
3 4 5 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 3 def target @target end |
Instance Method Details
#add_cookie(cookie) ⇒ Object
31 32 33 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 31 def () @cookies << end |
#add_header(name, value) ⇒ Object
27 28 29 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 27 def add_header(name, value) @headers[name] = value end |
#destination ⇒ Object
23 24 25 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 23 def destination @target end |
#send_error(code, msg = '') ⇒ Object
15 16 17 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 15 def send_error(code, msg = '') @error = {:code => code, :msg => msg} end |
#send_redirect(path) ⇒ Object
19 20 21 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 19 def send_redirect(path) @target = path end |
#set_status(x) ⇒ Object
11 12 13 |
# File 'lib/spec/vraptor/mocked_http_response.rb', line 11 def set_status(x) @status = x end |