Module: ActionDispatch::Integration::Runner
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
::ActionDispatch::Assertions,
Rails::Dom::Testing::Assertions,
::ActionDispatch::Assertions::RoutingAssertions,
::ActionDispatch::Assertions::ResponseAssertions
|
|
Defined in: | actionpack/lib/action_dispatch/testing/integration.rb |
Instance Attribute Summary
Instance Method Summary
- #app
-
#method_missing(sym, *args, &block)
Delegate unhandled messages to the current session instance.
-
#open_session
Open a new session instance.
-
#reset!
Reset the current session.
- #respond_to?(method, include_private = false) ⇒ Boolean
::ActionDispatch::Assertions - Included
::ActionDispatch::Assertions::RoutingAssertions - Included
#assert_generates | Asserts that the provided options can be used to generate the provided path. |
#assert_recognizes | Asserts that the routing of the given |
#assert_routing | Asserts that path and options match both ways; in other words, it verifies that |
#method_missing | ROUTES TODO: These assertions should really work in an integration context. |
#with_routing | A helper to make it easier to test different route configurations. |
::ActionDispatch::Assertions::ResponseAssertions - Included
#assert_redirected_to | Assert that the redirection options passed in match those of the redirect called in the latest action. |
#assert_response | Asserts that the response is one of the following types: |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block)
Delegate unhandled messages to the current session instance.
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 393
def method_missing(sym, *args, &block) reset! unless integration_session if integration_session.respond_to?(sym) integration_session.__send__(sym, *args, &block).tap do copy_session_variables! end else super end end
Instance Attribute Details
#default_url_options (rw)
[ GitHub ]# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 378
def reset! unless integration_session integration_session. end
#default_url_options=(options) (rw)
[ GitHub ]# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 383
def ( ) reset! unless integration_session integration_session. = end
Instance Method Details
#app
[ GitHub ]# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 320
def app @app ||= nil end
#open_session
Open a new session instance. If a block is given, the new session is yielded to the block before being returned.
session = open_session do |sess|
sess.extend(CustomAssertions)
end
By default, a single session is automatically created for you, but you can use this method to open multiple sessions that ought to be tested simultaneously.
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 362
def open_session dup.tap do |session| session.reset! yield session if block_given? end end
#reset!
Reset the current session. This is useful for testing multiple sessions in a single test case.
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 326
def reset! @integration_session = Integration::Session.new(app) end
#respond_to?(method, include_private = false) ⇒ Boolean
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 388
def respond_to?(method, include_private = false) integration_session.respond_to?(method, include_private) || super end