Permalink
Browse files

Integration tests: introduce methods for other HTTP methods. Closes #…

…6353.  Merges [6203]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@7319 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
NZKoz committed Aug 15, 2007
1 parent 6cc01c9 commit 631bf6b203be4d1d8ab0dac6792117aef2f96f8b
View
@@ -1,5 +1,7 @@
*SVN*
+* Integration tests: introduce methods for other HTTP methods. #6353 [caboose]
+
* Improve performance of action caching. Closes #8231 [skaes]
* Fix errors with around_filters which do not yield, restore 1.1 behaviour with after filters. Closes #8891 [skaes]
@@ -500,7 +500,7 @@ def reset!
@integration_session = open_session
end
- %w(get post cookies assigns xml_http_request).each do |method|
+ %w(get post put head delete cookies assigns xml_http_request).each do |method|
define_method(method) do |*args|
reset! unless @integration_session
# reset the html_document variable, but only for new get/post calls
@@ -11,7 +11,7 @@
module ActionController
module Integration
class Session
- def process
+ def process(*args)
end
def generic_url_rewriter
@@ -195,6 +195,43 @@ def test_xml_http_request_head
end
end
+class IntegrationTestTest < Test::Unit::TestCase
+
+ def setup
+ @test = ::ActionController::IntegrationTest.new(:default_test)
+ @test.class.stubs(:fixture_table_names).returns([])
+ @session = @test.open_session
+ end
+
+ def test_opens_new_session
+ @test.class.expects(:fixture_table_names).times(2).returns(['foo'])
+
+ session1 = @test.open_session { |sess| }
+ session2 = @test.open_session # implicit session
+
+ assert_equal ::ActionController::Integration::Session, session1.class
+ assert_equal ::ActionController::Integration::Session, session2.class
+ assert_not_equal session1, session2
+ end
+
+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
+
+ def self.fixture_table_names
+ []
+ end
+
+ def test_integration_methods_called
+ %w( get post head put delete ).each do |verb|
+ assert_nothing_raised("'#{verb}' should use integration test methods") { send(verb, '/') }
+ end
+ end
+
+end
+
# TODO
# class MockCGITest < Test::Unit::TestCase
# end

0 comments on commit 631bf6b

Please sign in to comment.