I have the following test:
test "vote for candidate" do
get :vote, @candidate[:id]
assert_equals(1, @candidate.votes.count)
end
Here is the method that I am trying to test:
def vote
@candidate = Candidate.find(params[:id])
@candidate.votes.create
redirect_to(candidates_path)
end
And here is the error that I keep getting:
CandidatesControllerTest#test_vote_for_candidate:
NoMethodError: undefined method `symbolize_keys' for "358247726":String
test/controllers/candidates_controller_test.rb:35:in `block in <class:CandidatesControllerTest>'
I am new to unit testing, and I cannot for the life of me figure out what I am doing wrong here. Any nudge in the right direction would be a great help.
Aucun commentaire:
Enregistrer un commentaire