2016-03-05 17:07:32 -05:00
|
|
|
require "bundler"
|
2010-10-15 07:53:33 -04:00
|
|
|
Bundler::GemHelper.install_tasks
|
2010-10-12 08:15:56 -04:00
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
desc "Set a relevant database.yml for testing"
|
2014-03-14 16:11:10 -04:00
|
|
|
task :prepare do
|
|
|
|
ENV["DB"] ||= "sqlite"
|
2017-06-10 01:28:48 -04:00
|
|
|
FileUtils.cp(
|
|
|
|
"spec/dummy_app/config/database.#{ENV['DB']}.yml",
|
|
|
|
"spec/dummy_app/config/database.yml"
|
|
|
|
)
|
2014-03-14 16:11:10 -04:00
|
|
|
end
|
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
require "rake/testtask"
|
|
|
|
desc "Run tests on PaperTrail with Test::Unit."
|
2009-05-27 11:21:20 -04:00
|
|
|
Rake::TestTask.new(:test) do |t|
|
2016-03-05 17:07:32 -05:00
|
|
|
t.libs << "lib"
|
|
|
|
t.libs << "test"
|
|
|
|
t.pattern = "test/**/*_test.rb"
|
2011-02-08 12:16:35 -05:00
|
|
|
t.verbose = false
|
2017-05-21 01:29:58 -04:00
|
|
|
|
|
|
|
# Enabling ruby interpreter warnings (-w) is, sadly, impractical. There are
|
|
|
|
# too many noisy warnings that we have no control over, e.g. caused by libs we
|
|
|
|
# depend on.
|
|
|
|
t.warning = false
|
2009-05-27 11:21:20 -04:00
|
|
|
end
|
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
require "rspec/core/rake_task"
|
|
|
|
desc "Run tests on PaperTrail with RSpec"
|
2016-02-06 23:53:05 -05:00
|
|
|
task(:spec).clear
|
|
|
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
|
|
|
t.verbose = false # hide list of specs bit.ly/1nVq3Jn
|
|
|
|
end
|
2013-08-27 15:12:33 -04:00
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
require "rubocop/rake_task"
|
2015-11-27 21:16:37 -05:00
|
|
|
RuboCop::RakeTask.new
|
|
|
|
|
2016-03-05 17:07:32 -05:00
|
|
|
desc "Default: run all available test suites"
|
2017-05-21 02:40:23 -04:00
|
|
|
task default: %i[rubocop prepare test spec]
|