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