From 74b9ec11f067a50335fff431f1213cc1c50d8b2d Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Tue, 3 Jan 2017 13:50:54 +0000 Subject: [PATCH] Load tasks only in test env --- Rakefile | 1 - lib/tasks/rubocop.rake | 5 ----- lib/tasks/test.rake | 7 +++++++ 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 lib/tasks/rubocop.rake diff --git a/Rakefile b/Rakefile index 802bdcc..358da59 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,3 @@ # frozen_string_literal: true Dir.glob('lib/tasks/*.rake').each { |r| import r } -task default: %w(db:migrate rates:load test rubocop) diff --git a/lib/tasks/rubocop.rake b/lib/tasks/rubocop.rake deleted file mode 100644 index 686fb05..0000000 --- a/lib/tasks/rubocop.rake +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require 'rubocop/rake_task' - -RuboCop::RakeTask.new diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index c2ace8f..f8e092e 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -1,9 +1,16 @@ # frozen_string_literal: true +return unless ENV['RACK_ENV'] == 'test' + require 'rake/testtask' +require 'rubocop/rake_task' Rake::TestTask.new(test: :environment) do |t| t.libs.push('lib') t.test_files = FileList['spec/*_spec.rb'] t.ruby_opts += ['-W0'] end + +RuboCop::RakeTask.new + +task default: %w(db:migrate rates:load test rubocop)