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 498
498:       def method_missing(sym, *args, &block)
499:         reset! unless @integration_session
500:         returning @integration_session.__send__(sym, *args, &block) do
501:           copy_session_variables!
502:         end
503:       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 465
465:       def open_session
466:         session = Integration::Session.new
467: 
468:         # delegate the fixture accessors back to the test instance
469:         extras = Module.new { attr_accessor :delegate, :test_result }
470:         if self.class.respond_to?(:fixture_table_names)
471:           self.class.fixture_table_names.each do |table_name|
472:             name = table_name.tr(".", "_")
473:             next unless respond_to?(name)
474:             extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) }
475:           end
476:         end
477: 
478:         # delegate add_assertion to the test case
479:         extras.__send__(:define_method, :add_assertion) { test_result.add_assertion }
480:         session.extend(extras)
481:         session.delegate = self
482:         session.test_result = @_result
483: 
484:         yield session if block_given?
485:         session
486:       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 439
439:       def reset!
440:         @integration_session = open_session
441:       end

[Validate]