diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-26 11:34:02 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-26 11:34:02 -0300 |
commit | b3d40546923b194a89be0d9e00758864fa60b9e8 (patch) | |
tree | 8acac475b371d61924c67a439704c82c61968fff /actionpack/test/new_base/test_helper.rb | |
parent | aa5512299041efb923cd582fd26009a72b9ec670 (diff) | |
parent | 2f59066470193c6219dfd958fc5d8096a2ddee68 (diff) | |
download | rails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.gz rails-b3d40546923b194a89be0d9e00758864fa60b9e8.tar.bz2 rails-b3d40546923b194a89be0d9e00758864fa60b9e8.zip |
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/test/new_base/test_helper.rb')
-rw-r--r-- | actionpack/test/new_base/test_helper.rb | 57 |
1 files changed, 13 insertions, 44 deletions
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb index 9401e692f1..d92029df7f 100644 --- a/actionpack/test/new_base/test_helper.rb +++ b/actionpack/test/new_base/test_helper.rb @@ -36,13 +36,13 @@ class Rack::TestCase < ActionController::IntegrationTest setup do ActionController::Base.session_options[:key] = "abc" ActionController::Base.session_options[:secret] = ("*" * 30) - + controllers = ActionController::Base.subclasses.map do |k| k.underscore.sub(/_controller$/, '') end - + ActionController::Routing.use_controllers!(controllers) - + # Move into a bootloader ActionController::Base.subclasses.each do |klass| klass = klass.constantize @@ -50,13 +50,13 @@ class Rack::TestCase < ActionController::IntegrationTest klass.class_eval do _write_layout_method end - end + end end - + def app @app ||= ActionController::Dispatcher.new end - + def self.testing(klass = nil) if klass @testing = "/#{klass.name.underscore}".sub!(/_controller$/, '') @@ -64,41 +64,23 @@ class Rack::TestCase < ActionController::IntegrationTest @testing end end - - def self.get(url) - setup do |test| - test.get url - end - end - + def get(thing, *args) if thing.is_a?(Symbol) - super("#{self.class.testing}/#{thing}") + super("#{self.class.testing}/#{thing}", *args) else super end end - + def assert_body(body) assert_equal body, Array.wrap(response.body).join end - - def self.assert_body(body) - test "body is set to '#{body}'" do - assert_body body - end - end - + def assert_status(code) assert_equal code, response.status end - - def self.assert_status(code) - test "status code is set to #{code}" do - assert_status code - end - end - + def assert_response(body, status = 200, headers = {}) assert_body body assert_status status @@ -106,27 +88,14 @@ class Rack::TestCase < ActionController::IntegrationTest assert_header header, value end end - + def assert_content_type(type) assert_equal type, response.headers["Content-Type"] end - - def self.assert_content_type(type) - test "content type is set to #{type}" do - assert_content_type(type) - end - end - + def assert_header(name, value) assert_equal value, response.headers[name] end - - def self.assert_header(name, value) - test "'#{name}' header is set to #{value.inspect}" do - assert_header(name, value) - end - end - end class ::ApplicationController < ActionController::Base |