Upgrade to Rails 2.0.2
Upgraded to Rails 2.0.2, except that we maintain vendor/rails/actionpack/lib/action_controller/routing.rb from Rail 1.2.6 (at least for now), so that Routes don't change. We still get to enjoy Rails's many new features. Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
This commit is contained in:
parent
0f6889e09f
commit
6873fc8026
1083 changed files with 52810 additions and 41058 deletions
|
@ -3,9 +3,7 @@ require File.dirname(__FILE__) + '/../abstract_unit'
|
|||
$:.unshift File.dirname(__FILE__) + '/../../../railties/lib'
|
||||
require 'action_controller/integration'
|
||||
|
||||
begin # rescue LoadError
|
||||
require 'mocha'
|
||||
require 'stubba'
|
||||
uses_mocha 'integration' do
|
||||
|
||||
# Stub process for testing.
|
||||
module ActionController
|
||||
|
@ -51,28 +49,49 @@ class SessionTest < Test::Unit::TestCase
|
|||
assert_equal 200, @session.follow_redirect!
|
||||
end
|
||||
|
||||
def test_get_via_redirect
|
||||
path = "/somepath"; args = {:id => '1'}
|
||||
def test_request_via_redirect_uses_given_method
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
|
||||
@session.expects(:put).with(path, args, headers)
|
||||
@session.stubs(:redirect?).returns(false)
|
||||
@session.request_via_redirect(:put, path, args, headers)
|
||||
end
|
||||
|
||||
@session.expects(:get).with(path,args)
|
||||
|
||||
@session.stubs(:redirect?).returns(true).then.returns(true).then.returns(false)
|
||||
def test_request_via_redirect_follows_redirects
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
|
||||
@session.stubs(:redirect?).returns(true, true, false)
|
||||
@session.expects(:follow_redirect!).times(2)
|
||||
@session.request_via_redirect(:get, path, args, headers)
|
||||
end
|
||||
|
||||
def test_request_via_redirect_returns_status
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
|
||||
@session.stubs(:redirect?).returns(false)
|
||||
@session.stubs(:status).returns(200)
|
||||
assert_equal 200, @session.get_via_redirect(path, args)
|
||||
assert_equal 200, @session.request_via_redirect(:get, path, args, headers)
|
||||
end
|
||||
|
||||
def test_get_via_redirect
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
|
||||
@session.expects(:request_via_redirect).with(:get, path, args, headers)
|
||||
@session.get_via_redirect(path, args, headers)
|
||||
end
|
||||
|
||||
def test_post_via_redirect
|
||||
path = "/somepath"; args = {:id => '1'}
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
|
||||
@session.expects(:request_via_redirect).with(:post, path, args, headers)
|
||||
@session.post_via_redirect(path, args, headers)
|
||||
end
|
||||
|
||||
@session.expects(:post).with(path,args)
|
||||
def test_put_via_redirect
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
|
||||
@session.expects(:request_via_redirect).with(:put, path, args, headers)
|
||||
@session.put_via_redirect(path, args, headers)
|
||||
end
|
||||
|
||||
@session.stubs(:redirect?).returns(true).then.returns(true).then.returns(false)
|
||||
@session.expects(:follow_redirect!).times(2)
|
||||
|
||||
@session.stubs(:status).returns(200)
|
||||
assert_equal 200, @session.post_via_redirect(path, args)
|
||||
def test_delete_via_redirect
|
||||
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
|
||||
@session.expects(:request_via_redirect).with(:delete, path, args, headers)
|
||||
@session.delete_via_redirect(path, args, headers)
|
||||
end
|
||||
|
||||
def test_url_for_with_controller
|
||||
|
@ -132,16 +151,6 @@ class SessionTest < Test::Unit::TestCase
|
|||
@session.head(path,params,headers)
|
||||
end
|
||||
|
||||
def test_xml_http_request_deprecated_call
|
||||
path = "/index"; params = "blah"; headers = {:location => 'blah'}
|
||||
headers_after_xhr = headers.merge(
|
||||
"X-Requested-With" => "XMLHttpRequest",
|
||||
"Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
|
||||
)
|
||||
@session.expects(:process).with(:post,path,params,headers_after_xhr)
|
||||
assert_deprecated { @session.xml_http_request(path,params,headers) }
|
||||
end
|
||||
|
||||
def test_xml_http_request_get
|
||||
path = "/index"; params = "blah"; headers = {:location => 'blah'}
|
||||
headers_after_xhr = headers.merge(
|
||||
|
@ -191,6 +200,15 @@ class SessionTest < Test::Unit::TestCase
|
|||
@session.expects(:process).with(:head,path,params,headers_after_xhr)
|
||||
@session.xml_http_request(:head,path,params,headers)
|
||||
end
|
||||
|
||||
def test_xml_http_request_override_accept
|
||||
path = "/index"; params = "blah"; headers = {:location => 'blah', "Accept" => "application/xml"}
|
||||
headers_after_xhr = headers.merge(
|
||||
"X-Requested-With" => "XMLHttpRequest"
|
||||
)
|
||||
@session.expects(:process).with(:post,path,params,headers_after_xhr)
|
||||
@session.xml_http_request(:post,path,params,headers)
|
||||
end
|
||||
end
|
||||
|
||||
class IntegrationTestTest < Test::Unit::TestCase
|
||||
|
@ -200,7 +218,7 @@ class IntegrationTestTest < Test::Unit::TestCase
|
|||
@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'])
|
||||
|
||||
|
@ -224,7 +242,7 @@ class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
|
|||
|
||||
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, '/') }
|
||||
assert_nothing_raised("'#{verb}' should use integration test methods") { send!(verb, '/') }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -234,6 +252,4 @@ end
|
|||
# class MockCGITest < Test::Unit::TestCase
|
||||
# end
|
||||
|
||||
rescue LoadError
|
||||
$stderr.puts "Skipping integration tests. `gem install mocha` and try again."
|
||||
end
|
||||
end # uses_mocha
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue