Delegate unhandled messages to the current session instance.
# File lib/action_controller/integration.rb, line 568 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
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 lib/action_controller/integration.rb, line 531 def open_session(application = nil) session = Integration::Session.new(application) # delegate the fixture accessors back to the test instance extras = Module.new { attr_accessor :delegate, :test_result } if self.class.respond_to?(:fixture_table_names) self.class.fixture_table_names.each do |table_name| name = table_name.tr(".", "_") next unless respond_to?(name, true) extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) } end end # delegate add_assertion to the test case extras.__send__(:define_method, :add_assertion) { test_result.add_assertion } session.extend(extras) session.delegate = self session.test_result = @_result yield session if block_given? session end
Generated with the Darkfish Rdoc Generator 2.