Skip to content
Browse files

Replace ad hoc Rack::Test with ActionController::IntegrationTest

  • Loading branch information...
1 parent f503a5d commit d8fffe7b23acce42bc3941d7bba47e07a66aed67 @lifo lifo committed May 20, 2009
Showing with 8 additions and 10 deletions.
  1. +1 −1 actionpack/Rakefile
  2. +7 −9 actionpack/test/new_base/test_helper.rb
View
2 actionpack/Rakefile
@@ -21,7 +21,7 @@ task :default => [ :test ]
# Run the unit tests
-desc "Run all unit tests" # Do not remove :test_new_base
+desc "Run all unit tests"
task :test => [:test_action_pack, :test_active_record_integration, :test_new_base]
Rake::TestTask.new(:test_action_pack) do |t|
View
16 actionpack/test/new_base/test_helper.rb
@@ -20,8 +20,8 @@
require 'action_controller/new_base'
require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
-require 'rubygems'
-require 'rack/test'
+require 'action_controller/testing/process'
+require 'action_controller/testing/integration'
module Rails
def self.env
@@ -32,9 +32,7 @@ def x.test?() true end
end
# Temporary base class
-class Rack::TestCase < ActiveSupport::TestCase
- include Rack::Test::Methods
-
+class Rack::TestCase < ActionController::IntegrationTest
setup do
ActionController::Base.session_options[:key] = "abc"
ActionController::Base.session_options[:secret] = ("*" * 30)
@@ -82,7 +80,7 @@ def get(thing, *args)
end
def assert_body(body)
- assert_equal body, Array.wrap(last_response.body).join
+ assert_equal body, Array.wrap(response.body).join
end
def self.assert_body(body)
@@ -92,7 +90,7 @@ def self.assert_body(body)
end
def assert_status(code)
- assert_equal code, last_response.status
+ assert_equal code, response.status
end
def self.assert_status(code)
@@ -110,7 +108,7 @@ def assert_response(body, status = 200, headers = {})
end
def assert_content_type(type)
- assert_equal type, last_response.headers["Content-Type"]
+ assert_equal type, response.headers["Content-Type"]
end
def self.assert_content_type(type)
@@ -120,7 +118,7 @@ def self.assert_content_type(type)
end
def assert_header(name, value)
- assert_equal value, last_response.headers[name]
+ assert_equal value, response.headers[name]
end
def self.assert_header(name, value)

0 comments on commit d8fffe7

Please sign in to comment.
Something went wrong with that request. Please try again.