Method: ActionDispatch::AssertionResponse#initialize
- Defined in:
- actionpack/lib/action_dispatch/testing/assertion_response.rb
#initialize(code_or_name) ⇒ AssertionResponse
Accepts a specific response status code as an Integer (404) or String (‘404’) or a response status range as a Symbol pseudo-code (:success, indicating any 200-299 status code).
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'actionpack/lib/action_dispatch/testing/assertion_response.rb', line 20 def initialize(code_or_name) if code_or_name.is_a?(Symbol) @name = code_or_name @code = code_from_name(code_or_name) else @name = name_from_code(code_or_name) @code = code_or_name end raise ArgumentError, "Invalid response name: #{name}" if @code.nil? raise ArgumentError, "Invalid response code: #{code}" if @name.nil? end |