diff options
author | wycats <wycats@gmail.com> | 2010-03-22 17:04:56 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-22 17:14:28 -0700 |
commit | 15c31c7639b4329eba341bbe894abc9b79edc5c3 (patch) | |
tree | 20e5bf0c72ab86c7f6a7493d79820d6df3b57a3f /actionpack/lib/action_dispatch/testing | |
parent | 1f93a46b435434b6d128493cd3480ca82e301766 (diff) | |
download | rails-15c31c7639b4329eba341bbe894abc9b79edc5c3.tar.gz rails-15c31c7639b4329eba341bbe894abc9b79edc5c3.tar.bz2 rails-15c31c7639b4329eba341bbe894abc9b79edc5c3.zip |
open_session can just return the a dup of the current context.
At this point, its entire purpose in the open_session {} case was to
delegate back to the IntegrationTest anyway.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 4ed62a6ac4..621d63c5e2 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -297,7 +297,7 @@ module ActionDispatch # Reset the current session. This is useful for testing multiple sessions # in a single test case. def reset! - @integration_session = open_session + @integration_session = Integration::Session.new(app) end %w(get post put head delete cookies assigns @@ -323,30 +323,9 @@ module ActionDispatch # can use this method to open multiple sessions that ought to be tested # simultaneously. def open_session(app = nil) - session = Integration::Session.new(app || self.app) - - # 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) - extras.__send__(:define_method, name) { |*args| - delegate.send(name, *args) - } - end + dup.tap do |session| + yield session if block_given? 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 # Copy the instance variables from the current session instance into the |