]> projects.mako.cc - selectricity/commitdiff
Add a few more testcases
authorJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 18:43:15 +0000 (14:43 -0400)
committerJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 18:43:15 +0000 (14:43 -0400)
test/functional/quickvote_controller_test.rb

index 3f230b2f56645e3f2878340148e508b97f256a84..ceb1b6b4b5d1cd518f75e305521a2cc8851d2f5f 100644 (file)
@@ -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'

Benjamin Mako Hill || Want to submit a patch?