X-Git-Url: https://projects.mako.cc/source/selectricity/blobdiff_plain/fc0a6a8d7ea15bcdb27ebdd58721401c7045c6e0..192728d0e5facadf7e41ed737ca59e5c14123efd:/test/functional/quickvote_controller_test.rb diff --git a/test/functional/quickvote_controller_test.rb b/test/functional/quickvote_controller_test.rb old mode 100755 new mode 100644 index d0b37d9..3f230b2 --- a/test/functional/quickvote_controller_test.rb +++ b/test/functional/quickvote_controller_test.rb @@ -1,6 +1,13 @@ require File.dirname(__FILE__) + '/../test_helper' require 'quickvote_controller' +class ActionController::TestSession + def session_id + # Override this so we can set session ID + # pass in the 'test_session_id' session variable to override default + (@session and @session['test_session_id']) or "12345678" + end +end # Re-raise errors caught by the controller. class QuickvoteController; def rescue_action(e) raise e end; end @@ -12,7 +19,20 @@ class QuickvoteControllerTest < Test::Unit::TestCase end # Replace this with your real tests. - def test_truth - assert true + def test_index + get :index + assert_response 302 + end + + def test_create_quickvote + post(:create, {'commit' =>"Create Quickvote", 'quickvote' =>{'name' =>"variable", 'description' =>"Favorite variable."}}, nil, {:candlist=>["foo", "bar", "foobar"]}) + assert_response :success + get :index, { 'ident' => "variable"} + assert_response :success + end + + def test_get_quickvote_nonexistent + get :index, { 'ident' => "idontexist" } + assert_redirected_to :controller => 'site' end end