Fix testcases and also fix errors the testcase brought up
[selectricity] / test / functional / quickvote_controller_test.rb
index 02c133e1508c40c28d7fdd1443f1a916d9ccfa80..fbeb4a53a0dadf20ae1cd50be68fc41208ec1098 100644 (file)
@@ -28,7 +28,7 @@ class QuickvoteControllerTest < Test::Unit::TestCase
   end
 
   def test_create_quickvote
-    post(:create, {'commit' =>"Create Quickvote", 'quickvote' =>{'name' =>"variable", 'description' =>"Favorite variable."}}, nil, {:candlist=>["foo", "bar", "foobar"]})
+    post(:create, {'commit' =>"Create Quickvote", 'quickvote' =>{'name' =>"variable", 'description' =>"Favorite variable."}}, nil, {:candidate_names=>["foo", "bar", "foobar"]})
     assert_template "quickvote/success"
     get :index, { 'ident' => "variable"}
     assert_response :success
@@ -42,20 +42,20 @@ class QuickvoteControllerTest < Test::Unit::TestCase
   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"
+    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => ["foo", "bar", "foobar"]})
+    assert_template "quickvote/_create_sidebar"
   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"
+    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => ["foo", "bar", "bar",  "foobar"]})
+    assert_template "quickvote/_create_sidebar"
   end
   
   def test_create_quickvote_nil_candidate
-    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candlist => nil})
-    assert_template "quickvote/create"
-    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candlist => []})
-    assert_template "quickvote/create"
+    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => nil})
+    assert_template "quickvote/_create_sidebar"
+    post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => []})
+    assert_template "quickvote/_create_sidebar"
   end
 
   def test_get_quickvote_nonexistent
@@ -119,7 +119,7 @@ class QuickvoteControllerTest < Test::Unit::TestCase
     test_create_quickvote
     qv=QuickVote.ident_to_quickvote('variable')
     qv.description="<object>foo</object>"
-    qv.candidatelist = ["<object>foo", "bar<object>", "<foobar>"]
+    qv.candidate_names = ["<object>foo", "bar<object>", "<foobar>"]
     qv.save!
     get :index, { 'ident' => 'variable' }
     assert_response :success

Benjamin Mako Hill || Want to submit a patch?