From 2a50eabf4576580dff9b43c3d830cd78e8fbb353 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 15 Mar 2010 19:26:58 -0700 Subject: Integration test url options should account for :protocol not just https? --- actionpack/lib/action_dispatch/testing/integration.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/action_dispatch/testing/integration.rb') diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 0aff4250c1..31067e56b4 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -177,14 +177,8 @@ module ActionDispatch reset! end - def url_options - opts = super.reverse_merge( - :host => host, - :protocol => https? ? "https" : "http" - ) - - opts.merge!(:port => 443) if !opts.key?(:port) && https? - opts + def default_url_options + { :host => host, :protocol => https? ? "https" : "http" } end # Resets the instance. This can be used to reset the state information -- cgit v1.2.3 From 6c0c0f41a3bad10c3c1acaf3124746f891f9ccbf Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Tue, 16 Mar 2010 12:26:14 +0100 Subject: Fix for missing dependency in ActionDispatch::Integration When running cucumber features from a new rails 3 app requiring 'cucumber/rails/world' would raise: uninitialized constant ActionDispatch::Integration::Session::Test (NameError) Fixed by requiring 'test/unit/assertions' in action_dispatch/integration Signed-off-by: Jeremy Kemper --- actionpack/lib/action_dispatch/testing/integration.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib/action_dispatch/testing/integration.rb') diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 31067e56b4..305c2bfc32 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -2,6 +2,7 @@ require 'stringio' require 'uri' require 'active_support/core_ext/object/singleton_class' require 'rack/test' +require 'test/unit/assertions' module ActionDispatch module Integration #:nodoc: -- cgit v1.2.3 From 0e15f07b75d04ddc349a93ad7fdfcbc502ef535d Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Wed, 17 Mar 2010 17:52:16 -0700 Subject: Get modules back into integration tests --- actionpack/lib/action_dispatch/testing/integration.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack/lib/action_dispatch/testing/integration.rb') diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 305c2bfc32..4ed62a6ac4 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -288,6 +288,8 @@ module ActionDispatch end module Runner + include ActionDispatch::Assertions + def app @app end @@ -455,6 +457,7 @@ module ActionDispatch # end class IntegrationTest < ActiveSupport::TestCase include Integration::Runner + include ActionController::TemplateAssertions @@app = nil -- cgit v1.2.3 From 15c31c7639b4329eba341bbe894abc9b79edc5c3 Mon Sep 17 00:00:00 2001 From: wycats Date: Mon, 22 Mar 2010 17:04:56 -0700 Subject: 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. --- .../lib/action_dispatch/testing/integration.rb | 27 +++------------------- 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'actionpack/lib/action_dispatch/testing/integration.rb') 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 -- cgit v1.2.3