+ @qv.save
+ end
+
+ def test_add_remove_candidates
+ # make sure the names are right
+ assert_equal 3, @qv.candidates.length
+ assert_equal @candidates.sort,
+ @qv.candidates.collect {|c| c.name}.sort
+
+ # add one candidate
+ @qv.candidates << Candidate.new({:name => 'erik'})
+ assert @qv.save
+ assert @qv.reload
+ assert_equal 4, @qv.candidates.length
+ assert_equal (@candidates + ['erik']).sort,
+ @qv.candidates.collect {|c| c.name}.sort
+
+ # drop erik and try again
+ @qv.candidates = \
+ @qv.candidates.select {|c| c.name != 'erik'}
+ assert @qv.save
+ assert @qv.reload
+ assert_equal 3, @qv.candidates.length
+ assert_equal @candidates.sort,
+ @qv.candidates.collect {|c| c.name}.sort
+ end
+
+ def test_create_update_quickvote
+ assert_kind_of QuickVote, @qv
+ assert_equal 1, @qv.id
+ assert_equal 'acetarium', @qv.name
+ assert_equal 'who is the winner?', @qv.description
+ assert_equal 'ssd', @qv.election_method
+ assert_equal '2007-08-22 12:00:00', @qv.startdate_before_type_cast
+ assert_equal '2010-09-21 11:59:59', @qv.enddate_before_type_cast
+
+ # should be set by default default results
+ assert_equal false, @qv.early_results
+ assert_equal false, @qv.kiosk
+ assert_equal true, @qv.authenticated
+ assert_equal false, @qv.embeddable
+ assert_equal true, @qv.verifiable