aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/new_base/test_helper.rb')
-rw-r--r--actionpack/test/new_base/test_helper.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index 78662dc989..a7302af060 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -59,12 +59,28 @@ class Rack::TestCase < ActiveSupport::TestCase
@app ||= ActionController::Dispatcher.new
end
+ def self.testing(klass = nil)
+ if klass
+ @testing = "/#{klass.name.underscore}".sub!(/_controller$/, '')
+ else
+ @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}")
+ else
+ super
+ end
+ end
+
def assert_body(body)
assert_equal body, Array.wrap(last_response.body).join
end
@@ -85,6 +101,14 @@ class Rack::TestCase < ActiveSupport::TestCase
end
end
+ def assert_response(body, status = 200, headers = {})
+ assert_body body
+ assert_status status
+ headers.each do |header, value|
+ assert_header header, value
+ end
+ end
+
def assert_content_type(type)
assert_equal type, last_response.headers["Content-Type"]
end