Module: AssertResponse::Methods
- Included in:
- Rack::Test::Methods
- Defined in:
- lib/assert-response.rb
Overview
these methods are included in Rack::Test::Methods to be used in a Test Class
call assert_response with a code block to use the DSL (methods from AssertResponse) or use a method like assert_response_xxx where xxx is the name of the method from AssertResponse you want to call
Instance Method Summary collapse
-
#assert_response(response = last_response, request = last_request, &code) ⇒ Object
creates an AssertResponse Object and
instance_exec
the code (DSL) in it. -
#method_missing(meth, *args, &code) ⇒ Object
route assert_response_ methods to AssertResponse.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &code) ⇒ Object
route assert_response_ methods to AssertResponse
400 401 402 403 404 405 406 |
# File 'lib/assert-response.rb', line 400 def method_missing(meth, *args, &code) if meth.to_s =~ /^assert_response_(.+)$/ AssertResponse.new(self, last_response, last_request).send($1.to_sym, *args, &code) else super end end |
Instance Method Details
#assert_response(response = last_response, request = last_request, &code) ⇒ Object
creates an AssertResponse Object and instance_exec
the code (DSL) in it
410 411 412 413 |
# File 'lib/assert-response.rb', line 410 def assert_response(response=last_response, request=last_request, &code) file, line, rest = caller[0].split(':', 3) AssertResponse.new(self, response, request).instance_exec(file, line.to_i, &code) end |