Commit 3b0c0ec42fa44bfcb4a388c31713320272449cc5

Authored by Luke Baker
1 parent 1da85d1e

fix up tests that were comparing strings to ints

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
lib/tasks/test_api.rake
@@ -235,7 +235,7 @@ namespace :test_api do @@ -235,7 +235,7 @@ namespace :test_api do
235 SUM(wins) AS total_wins, 235 SUM(wins) AS total_wins,
236 SUM(losses) AS total_losses FROM choices 236 SUM(losses) AS total_losses FROM choices
237 WHERE question_id = #{question.id}") 237 WHERE question_id = #{question.id}")
238 - if(totals["total"] != 2* question.votes_count) 238 + if(totals["total"].to_i != 2* question.votes_count)
239 error_message = "Question #{question.id}: Total votes != 2 x # vote objects, total: #{totals["total"]}, vote_count: #{question.votes_count}" 239 error_message = "Question #{question.id}: Total votes != 2 x # vote objects, total: #{totals["total"]}, vote_count: #{question.votes_count}"
240 end 240 end
241 return error_message.blank? ? [success_message, false] : [error_message, true] 241 return error_message.blank? ? [success_message, false] : [error_message, true]
@@ -250,7 +250,7 @@ namespace :test_api do @@ -250,7 +250,7 @@ namespace :test_api do
250 SUM(wins) AS total_wins, 250 SUM(wins) AS total_wins,
251 SUM(losses) AS total_losses FROM choices 251 SUM(losses) AS total_losses FROM choices
252 WHERE question_id = #{question.id}") 252 WHERE question_id = #{question.id}")
253 - if (!totals["total"].blank? && totals["total"] % 2 != 0) 253 + if (!totals["total"].blank? && totals["total"].to_i % 2 != 0)
254 error_message = "Question #{question.id}: Total votes is not even: #{totals["total"]}" 254 error_message = "Question #{question.id}: Total votes is not even: #{totals["total"]}"
255 end 255 end
256 return error_message.blank? ? [success_message, false] : [error_message, true] 256 return error_message.blank? ? [success_message, false] : [error_message, true]