diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 11:10:46 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-07 11:10:46 +0000 |
commit | a544d7aa372a080b77940571a3a169496045670e (patch) | |
tree | 1d4bfe7d3c28d896fe1c879fdc12c661e14cc8aa /actionpack/lib/action_controller | |
parent | 94921293dbdbdf7fe49023fe7ed8908e05d3615f (diff) | |
download | rails-a544d7aa372a080b77940571a3a169496045670e.tar.gz rails-a544d7aa372a080b77940571a3a169496045670e.tar.bz2 rails-a544d7aa372a080b77940571a3a169496045670e.zip |
Added all the HTTP methods as alternatives to the generic "process" for functional testing #276 [Tobias Luetke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@58 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 41386ee7d0..41fc2f209b 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -190,10 +190,23 @@ end class Test::Unit::TestCase #:nodoc: private # execute the request and set/volley the response - def process(action, parameters = nil, session = nil) + def get(action, parameters = nil, session = nil) + @request.env['REQUEST_METHOD'] ||= "GET" @request.action = action.to_s @request.parameters.update(parameters) unless parameters.nil? @request.session = ActionController::TestSession.new(session) unless session.nil? @controller.process(@request, @response) end + + # execute the request simulating a specific http method and set/volley the response + %w( post put delete head ).each do |method| + class_eval <<-EOV + def #{method}(action, parameters = nil, session = nil) + @request.env['REQUEST_METHOD'] ||= "#{method.upcase}" + get(action, parameters, session) + end +EOV + end + + alias :process :get end
\ No newline at end of file |