aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/request/json_params_parsing_test.rb2
-rw-r--r--actionpack/test/dispatch/request/query_string_parsing_test.rb4
-rw-r--r--actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb2
-rw-r--r--actionpack/test/dispatch/request/xml_params_parsing_test.rb4
-rw-r--r--actionpack/test/dispatch/request_test.rb4
-rw-r--r--actionpack/test/dispatch/routing_test.rb29
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb2
-rw-r--r--actionpack/test/dispatch/session/mem_cache_store_test.rb2
-rw-r--r--actionpack/test/dispatch/test_request_test.rb2
9 files changed, 34 insertions, 17 deletions
diff --git a/actionpack/test/dispatch/request/json_params_parsing_test.rb b/actionpack/test/dispatch/request/json_params_parsing_test.rb
index 3c2408de5f..d3308f73cc 100644
--- a/actionpack/test/dispatch/request/json_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/json_params_parsing_test.rb
@@ -57,7 +57,7 @@ class JsonParamsParsingTest < ActionController::IntegrationTest
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::JsonParamsParsingTest::TestController
end
yield
end
diff --git a/actionpack/test/dispatch/request/query_string_parsing_test.rb b/actionpack/test/dispatch/request/query_string_parsing_test.rb
index b764478d87..071d80c5b0 100644
--- a/actionpack/test/dispatch/request/query_string_parsing_test.rb
+++ b/actionpack/test/dispatch/request/query_string_parsing_test.rb
@@ -109,12 +109,12 @@ class QueryStringParsingTest < ActionController::IntegrationTest
def assert_parses(expected, actual)
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::QueryStringParsingTest::TestController
end
get "/parse", actual
assert_response :ok
- assert_equal(expected, TestController.last_query_parameters)
+ assert_equal(expected, ::QueryStringParsingTest::TestController.last_query_parameters)
end
end
end
diff --git a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
index e98a49980e..69dbd7f528 100644
--- a/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb
@@ -130,7 +130,7 @@ class UrlEncodedParamsParsingTest < ActionController::IntegrationTest
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::UrlEncodedParamsParsingTest::TestController
end
yield
end
diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
index 0dc47ed9d5..96189e4ca2 100644
--- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
@@ -84,7 +84,7 @@ class XmlParamsParsingTest < ActionController::IntegrationTest
def with_test_routing
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::XmlParamsParsingTest::TestController
end
yield
end
@@ -100,4 +100,4 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest
def default_headers
{'HTTP_X_POST_DATA_FORMAT' => 'xml'}
end
-end \ No newline at end of file
+end
diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb
index 239fda98e0..b62df9a6b2 100644
--- a/actionpack/test/dispatch/request_test.rb
+++ b/actionpack/test/dispatch/request_test.rb
@@ -432,6 +432,10 @@ class RequestTest < ActiveSupport::TestCase
request = stub_request
request.expects(:parameters).at_least_once.returns({ :format => :txt })
assert_equal with_set(Mime::TEXT), request.formats
+
+ request = stub_request
+ request.expects(:parameters).at_least_once.returns({ :format => :unknown })
+ assert request.formats.empty?
end
test "negotiate_mime" do
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 74e6c8e72d..ca07bc7a28 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -37,7 +37,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get 'admin', :to => "queenbee#index"
end
- constraints IpRestrictor do
+ constraints ::TestRoutingMapper::IpRestrictor do
get 'admin/accounts', :to => "queenbee#accounts"
end
@@ -80,7 +80,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- match 'sprockets.js', :to => SprocketsApp
+ match 'sprockets.js', :to => ::TestRoutingMapper::SprocketsApp
match 'people/:id/update', :to => 'people#update', :as => :update_person
match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person
@@ -190,8 +190,21 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
def test_projects
with_test_routes do
+ get '/projects'
+ assert_equal 'projects#index', @response.body
+ assert_equal '/projects', projects_path
+
+ get '/projects/new'
+ assert_equal 'projects#new', @response.body
+ assert_equal '/projects/new', new_project_path
+
get '/projects/1'
assert_equal 'projects#show', @response.body
+ assert_equal '/projects/1', project_path(:id => '1')
+
+ get '/projects/1/edit'
+ assert_equal 'projects#edit', @response.body
+ assert_equal '/projects/1/edit', edit_project_path(:id => '1')
end
end
@@ -231,7 +244,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'people#index', @response.body
get '/projects/1/companies/1/avatar'
- assert_equal 'avatar#show', @response.body
+ assert_equal 'avatars#show', @response.body
end
end
@@ -254,7 +267,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'people#show', @response.body
get '/projects/1/people/1/7a2dec8/avatar'
- assert_equal 'avatar#show', @response.body
+ assert_equal 'avatars#show', @response.body
put '/projects/1/people/1/accessible_projects'
assert_equal 'people#accessible_projects', @response.body
@@ -282,7 +295,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'posts#preview', @response.body
get '/projects/1/posts/1/subscription'
- assert_equal 'subscription#show', @response.body
+ assert_equal 'subscriptions#show', @response.body
get '/projects/1/posts/1/comments'
assert_equal 'comments#index', @response.body
@@ -329,13 +342,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
def test_account_namespace
with_test_routes do
get '/account/subscription'
- assert_equal 'subscription#show', @response.body
+ assert_equal 'subscriptions#show', @response.body
get '/account/credit'
- assert_equal 'credit#show', @response.body
+ assert_equal 'credits#show', @response.body
get '/account/credit_card'
- assert_equal 'credit_card#show', @response.body
+ assert_equal 'credit_cards#show', @response.body
end
end
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index edfc303d3d..ab7b9bc31b 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -219,7 +219,7 @@ class CookieStoreTest < ActionController::IntegrationTest
def with_test_route_set(options = {})
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::CookieStoreTest::TestController
end
options = {:key => SessionKey, :secret => SessionSecret}.merge(options)
@app = ActionDispatch::Session::CookieStore.new(set, options)
diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb
index afc9d91d50..5a1dcb4dab 100644
--- a/actionpack/test/dispatch/session/mem_cache_store_test.rb
+++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb
@@ -112,7 +112,7 @@ class MemCacheStoreTest < ActionController::IntegrationTest
def with_test_route_set
with_routing do |set|
set.draw do |map|
- match ':action', :to => TestController
+ match ':action', :to => ::MemCacheStoreTest::TestController
end
@app = ActionDispatch::Session::MemCacheStore.new(set, :key => '_session_id')
yield
diff --git a/actionpack/test/dispatch/test_request_test.rb b/actionpack/test/dispatch/test_request_test.rb
index b2006a0d2f..5da02b2ea6 100644
--- a/actionpack/test/dispatch/test_request_test.rb
+++ b/actionpack/test/dispatch/test_request_test.rb
@@ -5,7 +5,7 @@ class TestRequestTest < ActiveSupport::TestCase
env = ActionDispatch::TestRequest.new.env
assert_equal "GET", env.delete("REQUEST_METHOD")
- assert_equal nil, env.delete("HTTPS")
+ assert_equal "off", env.delete("HTTPS")
assert_equal "http", env.delete("rack.url_scheme")
assert_equal "example.org", env.delete("SERVER_NAME")
assert_equal "80", env.delete("SERVER_PORT")