Module ActionController::Integration::Runner
In: vendor/rails/actionpack/lib/action_controller/integration.rb

Methods

Public Instance methods

Delegate unhandled messages to the current session instance.

[Source]

     # File vendor/rails/actionpack/lib/action_controller/integration.rb, line 501
501:       def method_missing(sym, *args, &block)
502:         reset! unless @integration_session
503:         returning @integration_session.send!(sym, *args, &block) do
504:           copy_session_variables!
505:         end
506:       end

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.

[Source]

     # File vendor/rails/actionpack/lib/action_controller/integration.rb, line 468
468:       def open_session
469:         session = Integration::Session.new
470: 
471:         # delegate the fixture accessors back to the test instance
472:         extras = Module.new { attr_accessor :delegate, :test_result }
473:         if self.class.respond_to?(:fixture_table_names)
474:           self.class.fixture_table_names.each do |table_name|
475:             name = table_name.tr(".", "_")
476:             next unless respond_to?(name)
477:             extras.send!(:define_method, name) { |*args| delegate.send(name, *args) }
478:           end
479:         end
480: 
481:         # delegate add_assertion to the test case
482:         extras.send!(:define_method, :add_assertion) { test_result.add_assertion }
483:         session.extend(extras)
484:         session.delegate = self
485:         session.test_result = @_result
486: 
487:         yield session if block_given?
488:         session
489:       end

Reset the current session. This is useful for testing multiple sessions in a single test case.

[Source]

     # File vendor/rails/actionpack/lib/action_controller/integration.rb, line 442
442:       def reset!
443:         @integration_session = open_session
444:       end

[Validate]