From c4357055d747d74363240384ea5a0530ae3a31ab Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Thu, 2 Mar 2017 10:36:10 -0600 Subject: [PATCH] move quiz faker to new dev utilities location --- config/application.rb | 3 +++ lib/tasks/faker.rake | 10 ---------- {app/services => lib/utils}/fake_quiz.rb | 2 -- test/test_helper.rb | 2 ++ 4 files changed, 5 insertions(+), 12 deletions(-) delete mode 100644 lib/tasks/faker.rake rename {app/services => lib/utils}/fake_quiz.rb (98%) diff --git a/config/application.rb b/config/application.rb index 98b8077..ea7c038 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,5 +30,8 @@ module SkillAssessmentApp g.helper false g.routes false end + + # let's use lib/utils for dev only utility classes & helpers + config.autoload_paths << "#{Rails.root}/lib/utils" end end diff --git a/lib/tasks/faker.rake b/lib/tasks/faker.rake deleted file mode 100644 index 1d27021..0000000 --- a/lib/tasks/faker.rake +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -namespace :faker do - desc "Generates 10 fake candidates with results." - task results: :environment do - puts "Not for production use" and return if Rails.env == "production" - - faker = FakeQuiz.new - faker.create_completed_quizzes 10 - end -end diff --git a/app/services/fake_quiz.rb b/lib/utils/fake_quiz.rb similarity index 98% rename from app/services/fake_quiz.rb rename to lib/utils/fake_quiz.rb index 6929504..835305f 100644 --- a/app/services/fake_quiz.rb +++ b/lib/utils/fake_quiz.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true -# :nocov: class FakeQuiz def create_completed_quizzes num = 10 num.times do @@ -68,4 +67,3 @@ class FakeQuiz end end # rubocop:enable Metrics/MethodLength end -# :nocov: diff --git a/test/test_helper.rb b/test/test_helper.rb index 108c430..275642d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,6 +8,8 @@ SimpleCov.start 'rails' do add_group 'Services & Workers', %w(app/workers app/services) add_group "Jobs", 'app/jobs' add_group "Policies", 'app/policies' + + add_filter "/lib/utils/" # no need to test dev only utility classes end require File.expand_path('../../config/environment', __FILE__)