From 9f23a5d3ce924c8255115aa7290ae891abd113b5 Mon Sep 17 00:00:00 2001 From: Mark Moser <mark.moser@perficient.com> Date: Thu, 8 Sep 2016 10:39:26 -0500 Subject: [PATCH] rubocop noise: switched to predicate comparisons Also introduced because of .ruby-version specification http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/NumericPredicate --- app/controllers/candidate_controller.rb | 2 +- app/validators/input_options_presence_validator.rb | 2 +- app/workers/quiz_status.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index 78a5ec0..0cd4f4c 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -12,7 +12,7 @@ class CandidateController < ApplicationController end def welcome - render :welcome_back if current_candidate.answers.count > 0 + render :welcome_back if current_candidate.answers.count.positive? end def saved diff --git a/app/validators/input_options_presence_validator.rb b/app/validators/input_options_presence_validator.rb index 5a5c60d..0b2e89a 100644 --- a/app/validators/input_options_presence_validator.rb +++ b/app/validators/input_options_presence_validator.rb @@ -2,7 +2,7 @@ class InputOptionsPresenceValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return true unless record.input_type =~ /radio|check/i - return true if value.present? && value.count > 0 + return true if value.present? && value.count.positive? record.errors[attribute] << (options[:message] || "You must provide answer options for the selected input type.") diff --git a/app/workers/quiz_status.rb b/app/workers/quiz_status.rb index f97037e..bde0c82 100644 --- a/app/workers/quiz_status.rb +++ b/app/workers/quiz_status.rb @@ -7,7 +7,7 @@ class QuizStatus end def started - candidate.answers.count > 0 + candidate.answers.count.positive? end def on_summary