aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_process.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-17 11:38:01 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-17 11:38:01 +0000
commitdca7efa67ec12b986ed03844af588055c9d8bdb9 (patch)
tree13207b1dce3af68528ddfe11d32ee98f627eb0a0 /actionpack/lib/action_controller/test_process.rb
parentd5b67ed8d33dbde44d24d7d93135261062e550d1 (diff)
downloadrails-dca7efa67ec12b986ed03844af588055c9d8bdb9.tar.gz
rails-dca7efa67ec12b986ed03844af588055c9d8bdb9.tar.bz2
rails-dca7efa67ec12b986ed03844af588055c9d8bdb9.zip
Deprecated the majority of all the testing assertions and replaced them with a much smaller core and access to all the collections the old assertions relied on. That way the regular test/unit assertions can be used against these. Added documentation about how to use it all.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1189 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r--actionpack/lib/action_controller/test_process.rb43
1 files changed, 27 insertions, 16 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 6931e7cdcb..83cde64b85 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/assertions/action_pack_assertions'
-require File.dirname(__FILE__) + '/assertions/active_record_assertions'
+require File.dirname(__FILE__) + '/assertions'
+require File.dirname(__FILE__) + '/deprecated_assertions'
if defined?(RAILS_ROOT)
# Temporary hack for getting functional tests in Rails running under 1.8.2
@@ -94,17 +94,6 @@ module ActionController #:nodoc:
end
class TestResponse < AbstractResponse #:nodoc:
- # the class attribute ties a TestResponse to the assertions
- class << self
- attr_accessor :assertion_target
- end
-
- # initializer
- def initialize
- TestResponse.assertion_target=self# if TestResponse.assertion_target.nil?
- super()
- end
-
# the response code of the request
def response_code
headers['Status'][0,3].to_i rescue 0
@@ -126,10 +115,12 @@ module ActionController #:nodoc:
end
# was there a server-side error?
- def server_error?
+ def error?
(500..599).include?(response_code)
end
+ alias_method :server_error?, :error?
+
# returns the redirection location or nil
def redirect_url
redirect? ? headers['location'] : nil
@@ -281,8 +272,28 @@ module Test
get(@response.redirected_to.delete(:action), @response.redirected_to.stringify_keys)
end
- def assigns(name)
- @response.template.assigns[name.to_s]
+ def assigns(key = nil)
+ if key.nil?
+ @response.template.assigns
+ else
+ @response.template.assigns[key.to_s]
+ end
+ end
+
+ def session
+ @response.session
+ end
+
+ def flash
+ @response.flash
+ end
+
+ def cookies
+ @response.cookies
+ end
+
+ def redirect_to_url
+ @response.redirect_url
end
def build_request_uri(action, parameters)