From: John Dong Date: Mon, 20 Aug 2007 18:43:15 +0000 (-0400) Subject: Add a few more testcases X-Git-Url: https://projects.mako.cc/source/selectricity/commitdiff_plain/aca2ebb98aeae4744e3c50f9fca7e08a1dd784a2?ds=sidebyside;hp=d436b6b274166db559f06eb677cec930ccdb1af4 Add a few more testcases --- diff --git a/test/functional/quickvote_controller_test.rb b/test/functional/quickvote_controller_test.rb index 3f230b2..ceb1b6b 100644 --- a/test/functional/quickvote_controller_test.rb +++ b/test/functional/quickvote_controller_test.rb @@ -26,11 +26,21 @@ class QuickvoteControllerTest < Test::Unit::TestCase def test_create_quickvote post(:create, {'commit' =>"Create Quickvote", 'quickvote' =>{'name' =>"variable", 'description' =>"Favorite variable."}}, nil, {:candlist=>["foo", "bar", "foobar"]}) - assert_response :success + assert_template "quickvote/success" get :index, { 'ident' => "variable"} assert_response :success end + def test_create_quickvote_badname + post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candlist => ["foo", "bar", "foobar"]}) + assert_template "quickvote/create" + end + + def test_create_quickvote_dupe_candidate + post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candlist => ["foo", "bar", "bar", "foobar"]}) + assert_template "quickvote/create" + end + def test_get_quickvote_nonexistent get :index, { 'ident' => "idontexist" } assert_redirected_to :controller => 'site'