aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/fake_controllers.rb23
-rw-r--r--actionpack/test/controller/routing_test.rb23
-rw-r--r--actionpack/test/controller/test_test.rb15
3 files changed, 36 insertions, 25 deletions
diff --git a/actionpack/test/controller/fake_controllers.rb b/actionpack/test/controller/fake_controllers.rb
new file mode 100644
index 0000000000..43f933b0d8
--- /dev/null
+++ b/actionpack/test/controller/fake_controllers.rb
@@ -0,0 +1,23 @@
+module Object::Controllers
+ def self.const_available?(*args)
+ const_defined?(*args)
+ end
+
+ class ContentController < ActionController::Base
+ end
+
+ module Admin
+ def self.const_available?(*args)
+ const_defined?(*args)
+ end
+
+ class UserController < ActionController::Base
+ end
+ class NewsFeedController < ActionController::Base
+ end
+ end
+end
+
+ActionController::Routing::Routes.draw do |map|
+ map.connect ':controller/:action/:id'
+end
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 23d741a58f..cec1b0313d 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../abstract_unit'
+require File.dirname(__FILE__) + '/fake_controllers'
require 'test/unit'
require 'stringio'
@@ -94,28 +95,6 @@ class CodeGeneratorTests < Test::Unit::TestCase
end
end
-# XXX Extract to test/controller/fake_controllers.rb
-module Object::Controllers
- def self.const_available?(*args)
- const_defined?(*args)
- end
-
- class ContentController
- end
- module Admin
- def self.const_available?(*args)
- const_defined?(*args)
- end
-
- class UserController
- end
-
- class NewsFeedController
- end
- end
-end
-
-
class RecognitionTests < Test::Unit::TestCase
attr_accessor :generator
alias :g :generator
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 201fe03b44..0ebd6bc472 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../abstract_unit'
+require File.dirname(__FILE__) + '/fake_controllers'
class TestTest < Test::Unit::TestCase
class TestController < ActionController::Base
@@ -52,12 +53,12 @@ HTML
def test_process_without_flash
process :set_flash
- assert_flash_equal "><", "test"
+ assert_equal '><', flash['test']
end
def test_process_with_flash
process :set_flash, nil, nil, { "test" => "value" }
- assert_flash_equal ">value<", "test"
+ assert_equal '>value<', flash['test']
end
def test_process_with_request_uri_with_no_params
@@ -100,10 +101,18 @@ HTML
:only => { :tag => "li" } } }
end
- def test_assert_routing
+ def test_assert_generates
assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5'
end
+ def test_assert_routing
+ assert_routing 'content', :controller => 'content', :action => 'index'
+ end
+
+ def test_assert_routing_in_module
+ assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
+ end
+
def test_params_passing
get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'}
parsed_params = eval(@response.body)