1 require File.dirname(__FILE__) + '/../test_helper'
3 class QuickVoteTest < Test::Unit::TestCase
4 fixtures :elections, :candidates
7 @quickvote_normal = QuickVote.find(1)
10 def test_create_update_delete_quickvote_from_fixture
11 assert_kind_of QuickVote, @quickvote_normal
12 assert_equal 1, @quickvote_normal.id
13 assert_equal 'acetarium', @quickvote_normal.name
14 assert_equal 'who is the winner?', @quickvote_normal.description
15 #assert_equal QuickVote, @quickvote_normal.type
16 assert_equal 'ssd', @quickvote_normal.election_method
17 assert_equal '2007-08-22 12:00:00', @quickvote_normal.startdate_before_type_cast
18 assert_equal '2007-09-21 11:59:59', @quickvote_normal.enddate_before_type_cast
20 # make sure that the each of the three andidates
22 assert @quickvote_normal.candidates.include?(Candidate.find(i))
26 @quickvote_normal.name = 'foobar'
27 assert @quickvote_normal.save,
28 @quickvote_normal.errors.full_messages.join("; ")
30 @quickvote_normal.reload
31 assert_equal 'foobar', @quickvote_normal.name
34 def test_create_invalid_enddate
35 qv = QuickVote.find(2)
36 assert_equal qv.save, false, "created vote with invalid enddate"