Load tasks only in test env

This commit is contained in:
Hakan Ensari 2017-01-03 13:50:54 +00:00
parent 93e9e65a3d
commit 74b9ec11f0
3 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,3 @@
# frozen_string_literal: true # frozen_string_literal: true
Dir.glob('lib/tasks/*.rake').each { |r| import r } Dir.glob('lib/tasks/*.rake').each { |r| import r }
task default: %w(db:migrate rates:load test rubocop)

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
require 'rubocop/rake_task'
RuboCop::RakeTask.new

View File

@ -1,9 +1,16 @@
# frozen_string_literal: true # frozen_string_literal: true
return unless ENV['RACK_ENV'] == 'test'
require 'rake/testtask' require 'rake/testtask'
require 'rubocop/rake_task'
Rake::TestTask.new(test: :environment) do |t| Rake::TestTask.new(test: :environment) do |t|
t.libs.push('lib') t.libs.push('lib')
t.test_files = FileList['spec/*_spec.rb'] t.test_files = FileList['spec/*_spec.rb']
t.ruby_opts += ['-W0'] t.ruby_opts += ['-W0']
end end
RuboCop::RakeTask.new
task default: %w(db:migrate rates:load test rubocop)