aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-02-19 21:43:13 +0000
committerMichael Koziarski <michael@koziarski.com>2008-02-19 21:43:13 +0000
commit1537aec18453907db3e67dc366eb51f11f94055d (patch)
treee1094c8d33008aa5f05c992282581e0f51c4b15e /actionpack/test/controller/integration_test.rb
parente32149ad600796efcf7191eff0946ca9616c4d65 (diff)
downloadrails-1537aec18453907db3e67dc366eb51f11f94055d.tar.gz
rails-1537aec18453907db3e67dc366eb51f11f94055d.tar.bz2
rails-1537aec18453907db3e67dc366eb51f11f94055d.zip
use stubbing instead of monkeypatching to stop tests from interfering with one another. Closes #11163 [RubyRedRick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8899 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/integration_test.rb')
-rw-r--r--actionpack/test/controller/integration_test.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index 83571f5e5e..62c00c5b9a 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -3,23 +3,21 @@ require 'action_controller/integration'
uses_mocha 'integration' do
-# Stub process for testing.
-module ActionController
- module Integration
- class Session
- def process(*args)
- end
-
- def generic_url_rewriter
- end
- end
+module IntegrationSessionStubbing
+ def stub_integration_session(session)
+ session.stubs(:process)
+ session.stubs(:generic_url_rewriter)
end
end
class SessionTest < Test::Unit::TestCase
+ include IntegrationSessionStubbing
+
def setup
@session = ActionController::Integration::Session.new
+ stub_integration_session(@session)
end
+
def test_https_bang_works_and_sets_truth_by_default
assert !@session.https?
@session.https!
@@ -210,11 +208,13 @@ class SessionTest < Test::Unit::TestCase
end
class IntegrationTestTest < Test::Unit::TestCase
+ include IntegrationSessionStubbing
def setup
@test = ::ActionController::IntegrationTest.new(:default_test)
@test.class.stubs(:fixture_table_names).returns([])
@session = @test.open_session
+ stub_integration_session(@session)
end
def test_opens_new_session
@@ -233,12 +233,15 @@ end
# Tests that integration tests don't call Controller test methods for processing.
# Integration tests have their own setup and teardown.
class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
+ include IntegrationSessionStubbing
def self.fixture_table_names
[]
end
def test_integration_methods_called
+ reset!
+ stub_integration_session(@integration_session)
%w( get post head put delete ).each do |verb|
assert_nothing_raised("'#{verb}' should use integration test methods") { send!(verb, '/') }
end
@@ -246,8 +249,4 @@ class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
end
-# TODO
-# class MockCGITest < Test::Unit::TestCase
-# end
-
end # uses_mocha