Sha256: 290cbdd3c365b3b63b09c94d3dd441aa4b99704b540c8485ab24679b2d101933

Contents?: true

Size: 658 Bytes

Versions: 8

Compression:

Stored size: 658 Bytes

Contents

require 'test_helper'

class VotesControllerTest < ActionController::TestCase
  fixtures :users, :posts, :roles

  def setup
    Vote.destroy_all
    Poll.destroy_all
  end

  def test_should_create_vote    
    assert posts(:funny_post).create_poll({:question => 'Who can have a great time?'}, ['I can', 'You can', 'No one can'])
      
    poll = posts(:funny_post).poll
    
    assert_equal 0, poll.votes_count
    
    login_as :quentin
    assert_difference Vote, :count, 1 do
      post :create, :choice_id => Choice.find(:first).id, :format => 'js'
    end
    assert_response :success
    
    assert_equal 1, poll.reload.votes_count    
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
community_engine-2.3.2 test/functional/votes_controller_test.rb
community_engine-2.3.1 test/functional/votes_controller_test.rb
community_engine-2.3.0 test/functional/votes_controller_test.rb
community_engine-2.1.0 test/functional/votes_controller_test.rb
community_engine-2.0.0 test/functional/votes_controller_test.rb
community_engine-2.0.0.beta3 test/functional/votes_controller_test.rb
community_engine-2.0.0.beta2 test/functional/votes_controller_test.rb
community_engine-2.0.0.beta1 test/functional/votes_controller_test.rb