From aca2ebb98aeae4744e3c50f9fca7e08a1dd784a2 Mon Sep 17 00:00:00 2001 From: John Dong Date: Mon, 20 Aug 2007 14:43:15 -0400 Subject: [PATCH] Add a few more testcases --- test/functional/quickvote_controller_test.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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' -- 2.39.5