aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorwycats <wycats@gmail.com>2010-06-08 18:10:27 -0400
committerwycats <wycats@gmail.com>2010-06-08 18:10:27 -0400
commitdf40dbe6f13c6799e972b20dcc1fbf11f0a02c61 (patch)
treed3daec753c2e55c859c63053d8411306bb11d603 /actionpack/test
parent6ebc7c8ee6de0f3f441a68baa6351416a6ac0a59 (diff)
parent5c9f27abaabba0d008ccd710ed1af5f6caa4e371 (diff)
downloadrails-df40dbe6f13c6799e972b20dcc1fbf11f0a02c61.tar.gz
rails-df40dbe6f13c6799e972b20dcc1fbf11f0a02c61.tar.bz2
rails-df40dbe6f13c6799e972b20dcc1fbf11f0a02c61.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/abstract_unit.rb3
-rw-r--r--actionpack/test/controller/filters_test.rb6
-rw-r--r--actionpack/test/dispatch/routing_test.rb61
-rw-r--r--actionpack/test/template/test_case_test.rb4
4 files changed, 35 insertions, 39 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index d2e5d2e965..84c5395610 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -24,6 +24,9 @@ require 'action_view/testing/resolvers'
require 'action_dispatch'
require 'active_support/dependencies'
require 'active_model'
+require 'active_record'
+require 'action_controller/caching'
+require 'action_controller/caching/sweeping'
begin
require 'ruby-debug'
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index d5704eba78..25b78124e3 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -445,6 +445,12 @@ class FilterTest < ActionController::TestCase
end
+
+ def test_before_method_of_sweeper_should_always_return_true
+ sweeper = ActionController::Caching::Sweeper.send(:new)
+ assert sweeper.before(TestController.new)
+ end
+
def test_non_yielding_around_filters_not_returning_false_do_not_raise
controller = NonYieldingAroundFilterController.new
controller.instance_variable_set "@filter_return_value", true
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index a294535e88..e13960e0dc 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -34,33 +34,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- resources :users do
- shallow do
- resources :photos do
- resources :types do
- member do
- post :preview
- end
- collection do
- delete :erase
- end
- end
- end
- end
- end
-
- shallow do
- resources :teams do
- resources :players
- end
-
- resources :countries do
- resources :cities do
- resources :places
- end
- end
- end
-
match 'account/logout' => redirect("/logout"), :as => :logout_redirect
match 'account/login', :to => redirect("/login")
@@ -171,6 +144,16 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
resources :sheep
+ resources :clients do
+ namespace :google do
+ resource :account do
+ namespace :secret do
+ resource :info
+ end
+ end
+ end
+ end
+
match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp
match 'people/:id/update', :to => 'people#update', :as => :update_person
@@ -779,18 +762,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- def test_shallow_routes
- with_test_routes do
- assert_equal '/photos/4', photo_path(4)
- assert_equal '/types/10/edit', edit_type_path(10)
- assert_equal '/types/5/preview', preview_type_path(5)
- assert_equal '/photos/2/types', photo_types_path(2)
- assert_equal '/cities/1/places', url_for(:controller => :places, :action => :index, :city_id => 1, :only_path => true)
- assert_equal '/teams/new', url_for(:controller => :teams, :action => :new, :only_path => true)
- assert_equal '/photos/11/types/erase', url_for(:controller => :types, :action => :erase, :photo_id => 11, :only_path => true)
- end
- end
-
def test_update_project_person
with_test_routes do
get '/projects/1/people/2/update'
@@ -852,6 +823,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal '/account/admin/subscription', account_admin_subscription_path
end
end
+
+ def test_namespace_nested_in_resources
+ with_test_routes do
+ get '/clients/1/google/account'
+ assert_equal '/clients/1/google/account', client_google_account_path(1)
+ assert_equal 'google/accounts#show', @response.body
+
+ get '/clients/1/google/account/secret/info'
+ assert_equal '/clients/1/google/account/secret/info', client_google_account_secret_info_path(1)
+ assert_equal 'google/secret/infos#show', @response.body
+ end
+ end
def test_articles_with_id
with_test_routes do
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index 16e5ee4f72..9b50ea8a42 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -37,6 +37,10 @@ module ActionView
include SharedTests
test_case = self
+ test "memoizes the _view" do
+ assert_same _view, _view
+ end
+
test "works without testing a helper module" do
assert_equal 'Eloy', render('developers/developer', :developer => stub(:name => 'Eloy'))
end