aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-08-23 01:21:43 +0200
committerXavier Noria <fxn@hashref.com>2010-08-23 01:21:43 +0200
commitb587bfd589cbb4469b9e49bfdd90f033d14adc9a (patch)
treed5fd06c8a1238dca62d3f3b512a6f19b63bc4b0e /actionpack/test
parent9992a1a4bff1dd666298866c283ba18832da0914 (diff)
parent8d1ee434da3348089daa497980d1e24837ee8be6 (diff)
downloadrails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.tar.gz
rails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.tar.bz2
rails-b587bfd589cbb4469b9e49bfdd90f033d14adc9a.zip
Merge remote branch 'rails/master'
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract_unit.rb12
-rw-r--r--actionpack/test/controller/routing_test.rb2
-rw-r--r--actionpack/test/dispatch/routing_test.rb21
-rw-r--r--actionpack/test/template/template_test.rb9
4 files changed, 33 insertions, 11 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index fb6961d4a3..869842fc9c 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -12,8 +12,16 @@ $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
-if defined?(Encoding.default_internal)
- Encoding.default_internal = "UTF-8"
+require 'active_support/core_ext/kernel/reporting'
+
+require 'active_support/core_ext/string/encoding'
+if "ruby".encoding_aware?
+ # These are the normal settings that will be set up by Railties
+ # TODO: Have these tests support other combinations of these values
+ silence_warnings do
+ Encoding.default_internal = "UTF-8"
+ Encoding.default_external = "UTF-8"
+ end
end
require 'test/unit'
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index fc85b01394..a8c74a6064 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -956,7 +956,7 @@ class RouteSetTest < ActiveSupport::TestCase
params = set.recognize_path("/people", :method => :put)
assert_equal("update", params[:action])
- assert_raise(ActionController::RoutingError) {
+ assert_raise(ActionController::UnknownHttpMethod) {
set.recognize_path("/people", :method => :bacon)
}
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 44b83f3afc..c529db4771 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -427,6 +427,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
get :preview, :on => :member
end
+ scope '/countries/:country', :constraints => lambda { |params, req| %[all France].include?(params[:country]) } do
+ match '/', :to => 'countries#index'
+ match '/cities', :to => 'countries#cities'
+ end
+
+ match '/countries/:country/(*other)', :to => redirect{ |params, req| params[:other] ? "/countries/all/#{params[:other]}" : '/countries/all' }
+
match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
end
end
@@ -2013,6 +2020,20 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_symbolized_path_parameters_is_not_stale
+ get '/countries/France'
+ assert_equal 'countries#index', @response.body
+
+ get '/countries/France/cities'
+ assert_equal 'countries#cities', @response.body
+
+ get '/countries/UK'
+ verify_redirect 'http://www.example.com/countries/all'
+
+ get '/countries/UK/cities'
+ verify_redirect 'http://www.example.com/countries/all/cities'
+ end
+
private
def with_test_routes
yield
diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb
index 18e0e83ec3..fbc9350c69 100644
--- a/actionpack/test/template/template_test.rb
+++ b/actionpack/test/template/template_test.rb
@@ -1,12 +1,5 @@
require "abstract_unit"
-if "ruby".encoding_aware?
- # These are the normal settings that will be set up by Railties
- # TODO: Have these tests support other combinations of these values
- Encoding.default_internal = "UTF-8"
- Encoding.default_external = "UTF-8"
-end
-
class TestERBTemplate < ActiveSupport::TestCase
ERBHandler = ActionView::Template::Handlers::ERB
@@ -136,4 +129,4 @@ class TestERBTemplate < ActiveSupport::TestCase
Encoding.default_external = old
end
end
-end \ No newline at end of file
+end