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 446
446:       def method_missing(sym, *args, &block)
447:         reset! unless @integration_session
448:         returning @integration_session.send!(sym, *args, &block) do
449:           copy_session_variables!
450:         end
451:       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 413
413:       def open_session
414:         session = Integration::Session.new
415: 
416:         # delegate the fixture accessors back to the test instance
417:         extras = Module.new { attr_accessor :delegate, :test_result }
418:         if self.class.respond_to?(:fixture_table_names)
419:           self.class.fixture_table_names.each do |table_name|
420:             name = table_name.tr(".", "_")
421:             next unless respond_to?(name)
422:             extras.send!(:define_method, name) { |*args| delegate.send(name, *args) }
423:           end
424:         end
425: 
426:         # delegate add_assertion to the test case
427:         extras.send!(:define_method, :add_assertion) { test_result.add_assertion }
428:         session.extend(extras)
429:         session.delegate = self
430:         session.test_result = @_result
431: 
432:         yield session if block_given?
433:         session
434:       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 387
387:       def reset!
388:         @integration_session = open_session
389:       end

[Validate]