public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Added fourth option to process in test cases to specify the content of the 
flash #949 [Jamis Buck]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1009 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Sat Mar 26 13:43:25 -0800 2005
commit  9fb6a54a164e7a1b64cf36efcba657c4215858b8
tree    7eefb985a625d09942ad73143fe1374dbe3392fc
parent  f569a14318e25005dfe27a51b3950c426581f18f
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Added fourth option to process in test cases to specify the content of the flash #949 [Jamis Buck]
0
+
0
 * Added Verifications that allows you to specify preconditions to actions in form of statements like <tt>verify :only => :update_post, :params => "admin_privileges", :redirect_to => { :action => "settings" }</tt>, which ensure that the update_post action is only called if admin_privileges is available as a parameter -- otherwise the user is redirected to settings. #897 [Jamis Buck]
0
 
0
 * Fixed Form.Serialize for the JavascriptHelper to also seriliaze password fields #934 [dweitzman@gmail.com]
...
251
252
253
254
 
255
256
257
258
259
 
260
261
262
...
251
252
253
 
254
255
256
257
258
259
260
261
262
263
0
@@ -251,12 +251,13 @@
0
     class TestCase #:nodoc:
0
       private
0
         # execute the request and set/volley the response
0
- def process(action, parameters = nil, session = nil = nil)
0
+ def process(action, parameters = nil, session = nil, flash = nil)
0
           @request.env['REQUEST_METHOD'] ||= "GET"
0
           @request.action = action.to_s
0
           @request.path_parameters = { :controller => @controller.class.controller_path }
0
           @request.parameters.update(parameters) unless parameters.nil?
0
           @request.session = ActionController::TestSession.new(session) unless session.nil?
0
+ @request.session["flash"] = ActionController::Flash::FlashHash.new.update(flash) if flash
0
           @controller.process(@request, @response)
0
         end
0
     
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
0
@@ -1 +1,26 @@
0
+require File.dirname(__FILE__) + '/../abstract_unit'
0
+
0
+class TestTest < Test::Unit::TestCase
0
+ class TestController < ActionController::Base
0
+ def set_flash
0
+ flash["test"] = ">#{flash["test"]}<"
0
+ end
0
+ end
0
+
0
+ def setup
0
+ @controller = TestController.new
0
+ @request = ActionController::TestRequest.new
0
+ @response = ActionController::TestResponse.new
0
+ end
0
+
0
+ def test_process_without_flash
0
+ process :set_flash
0
+ assert_flash_equal "><", "test"
0
+ end
0
+
0
+ def test_process_with_flash
0
+ process :set_flash, nil, nil, { "test" => "value" }
0
+ assert_flash_equal ">value<", "test"
0
+ end
0
+end

Comments

    No one has commented yet.