Module: ActionDispatch::Integration::Runner
- Extended by:
- ActiveSupport::Concern
- Includes:
- Assertions, Routing::UrlFor
- Defined in:
- actionpack/lib/action_dispatch/testing/integration.rb
Constant Summary
Constant Summary
Constants included from Assertions
Instance Method Summary (collapse)
- - (Object) app
-
- (Object) copy_session_variables!
Copy the instance variables from the current session instance into the test instance.
-
- (Object) method_missing(sym, *args, &block)
Delegate unhandled messages to the current session instance.
-
- (Object) open_session(app = nil)
Open a new session instance.
-
- (Object) reset!
Reset the current session.
- - (Object) url_options
Methods included from ActiveSupport::Concern
append_features, extended, included
Methods included from Routing::UrlFor
Methods included from Routing::PolymorphicRoutes
#polymorphic_path, #polymorphic_url
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(sym, *args, &block)
Delegate unhandled messages to the current session instance.
363 364 365 366 367 368 369 370 371 372 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 363 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 Method Details
- (Object) app
307 308 309 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 307 def app @app end |
- (Object) copy_session_variables!
Copy the instance variables from the current session instance into the test instance.
347 348 349 350 351 352 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 347 def copy_session_variables! #:nodoc: return unless @integration_session %w(controller response request).each do |var| instance_variable_set("@#{var}", @integration_session.__send__(var)) end end |
- (Object) open_session(app = nil)
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.
339 340 341 342 343 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 339 def open_session(app = nil) dup.tap do |session| yield session if block_given? end end |
- (Object) reset!
Reset the current session. This is useful for testing multiple sessions in a single test case.
313 314 315 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 313 def reset! @integration_session = Integration::Session.new(app) end |
- (Object) url_options
357 358 359 360 |
# File 'actionpack/lib/action_dispatch/testing/integration.rb', line 357 def reset! unless @integration_session @integration_session. end |