1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'quickvote_controller'
4 class ActionController::TestSession
6 # Override this so we can set session ID
7 # pass in the 'test_session_id' session variable to override default
8 (@session and @session['test_session_id']) or "12345678"
11 # Re-raise errors caught by the controller.
12 class QuickvoteController; def rescue_action(e) raise e end; end
14 class QuickvoteControllerTest < Test::Unit::TestCase
16 @controller = QuickvoteController.new
17 @request = ActionController::TestRequest.new
18 @response = ActionController::TestResponse.new
21 # Replace this with your real tests.
27 def test_create_quickvote
28 post(:create, {'commit' =>"Create Quickvote", 'quickvote' =>{'name' =>"variable", 'description' =>"Favorite variable."}}, nil, {:candlist=>["foo", "bar", "foobar"]})
29 assert_response :success
30 get :index, { 'ident' => "variable"}
31 assert_response :success
34 def test_get_quickvote_nonexistent
35 get :index, { 'ident' => "idontexist" }
36 assert_redirected_to :controller => 'site'