rubocop noise: introduced and resolved rails specific cop
http://rubocop.readthedocs.io/en/latest/cops/#rails
This commit is contained in:
parent
b74249a05f
commit
d54b99135e
@ -54,3 +54,6 @@ Metrics/LineLength:
|
||||
Metrics/MethodLength:
|
||||
Exclude:
|
||||
- db/migrate/*
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
@ -9,9 +9,9 @@ class Candidate < ApplicationRecord
|
||||
|
||||
before_validation(:generate_test_hash, on: :create)
|
||||
|
||||
validates_presence_of :recruiter_id
|
||||
validates_presence_of :name
|
||||
validates_presence_of :experience
|
||||
validates :recruiter_id, presence: true
|
||||
validates :name, presence: true
|
||||
validates :experience, presence: true
|
||||
validates :email, uniqueness: true, presence: true, email_format: true
|
||||
validates :test_hash, uniqueness: true, presence: true
|
||||
|
||||
|
@ -18,7 +18,7 @@ class User < ApplicationRecord
|
||||
def gen_reset_token
|
||||
loop do
|
||||
self[:reset_token] = SecureRandom.urlsafe_base64(10)
|
||||
self[:reset_timestamp] = DateTime.now
|
||||
self[:reset_timestamp] = DateTime.current
|
||||
break unless User.exists?(reset_token: self[:reset_token])
|
||||
end
|
||||
end
|
||||
|
@ -14,9 +14,7 @@ class QuizStatus
|
||||
candidate.submitted_answers.count == candidate.questions.count
|
||||
end
|
||||
|
||||
def completed
|
||||
candidate.completed
|
||||
end
|
||||
delegate :completed, to: :candidate
|
||||
|
||||
def can_submit
|
||||
on_summary &&
|
||||
|
@ -2,5 +2,5 @@
|
||||
# TODO: needs better wrapping instead of nuking
|
||||
# https://rubyplus.com/articles/3401
|
||||
ActionView::Base.field_error_proc = proc do |html_tag, _instance|
|
||||
html_tag.html_safe
|
||||
html_tag
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ class CandidateQuizQuestionTest < ActiveSupport::TestCase
|
||||
"input_options" => %w(one two three).to_yaml,
|
||||
"answer" => { test: 1, foo: 'bar', cheer: 'huzzah!' }.to_yaml,
|
||||
"saved" => false, "submitted" => true,
|
||||
"updated_at" => DateTime.parse('20160816') }
|
||||
"updated_at" => DateTime.parse('20160816').in_time_zone }
|
||||
end
|
||||
|
||||
test "propper dot attributes work" do
|
||||
@ -22,7 +22,7 @@ class CandidateQuizQuestionTest < ActiveSupport::TestCase
|
||||
assert_equal 'text', question.input_type
|
||||
assert_equal false, question.saved
|
||||
assert_equal true, question.submitted
|
||||
assert_equal DateTime.parse('20160816'), question.updated_at
|
||||
assert_equal DateTime.parse('20160816').in_time_zone, question.updated_at
|
||||
end
|
||||
|
||||
test 'should handle array of input options' do
|
||||
|
Loading…
Reference in New Issue
Block a user