]> projects.mako.cc - selectricity-live/commitdiff
Add test case for attempting to cast another vote with same sessid
authorJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 20:02:42 +0000 (16:02 -0400)
committerJohn Dong <jdong@mit.edu>
Mon, 20 Aug 2007 20:02:42 +0000 (16:02 -0400)
test/functional/quickvote_controller_test.rb

index a390d9462b19453558a2f993c9ce29296e64da76..076a1047c0780dfe1c10a97f8b6a7475ae3ff6c1 100644 (file)
@@ -100,4 +100,19 @@ class QuickvoteControllerTest < Test::Unit::TestCase
     post :confirm, { 'ident' => 'variable', 'rankings-list' => votes.sort_by {rand} }
     assert_template 'quickvote/thanks'
   end
     post :confirm, { 'ident' => 'variable', 'rankings-list' => votes.sort_by {rand} }
     assert_template 'quickvote/thanks'
   end
+
+  def test_cast_dupe_quickvote
+    test_create_quickvote
+    votes = QuickVote.ident_to_quickvote('variable').candidates.collect { |c| c.id}
+    get :index, { 'ident' => 'variable' }
+    assert_response :success
+
+    post :confirm, { 'ident' => 'variable', 'rankings-list' => votes.sort_by {rand} }
+    assert_template 'quickvote/thanks'
+
+    get :index, { 'ident' => 'variable' }
+    assert_response :success
+    post :confirm, { 'ident' => 'variable', 'rankings-list' => votes.sort_by {rand} }
+    assert_redirected_to :controller => 'quickvote', :ident => 'variable'
+  end
 end
 end

Benjamin Mako Hill || Want to submit a patch?