Add test case for attempting to cast another vote with same sessid
[selectricity] / 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
+
+  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

Benjamin Mako Hill || Want to submit a patch?