Sha256: e67a505b674a35ab663ef4ec0620b011fb4c5a164320a8279459be2decebf613

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

require "bundler"
Bundler::GemHelper.install_tasks

desc "Set a relevant database.yml for testing"
task :prepare do
  ENV["DB"] ||= "sqlite"
  FileUtils.cp(
    "spec/dummy_app/config/database.#{ENV['DB']}.yml",
    "spec/dummy_app/config/database.yml"
  )
end

require "rake/testtask"
desc "Run tests on PaperTrail with Test::Unit."
Rake::TestTask.new(:test) do |t|
  t.libs << "lib"
  t.libs << "test"
  t.pattern = "test/**/*_test.rb"
  t.verbose = false

  # 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
end

require "rspec/core/rake_task"
desc "Run tests on PaperTrail with RSpec"
task(:spec).clear
RSpec::Core::RakeTask.new(:spec) do |t|
  t.verbose = false # hide list of specs bit.ly/1nVq3Jn
end

task :autocorrect do
  rules = [
    'FrozenStringLiteralComment',
    'Layout/EmptyLineAfterMagicComment',
    'Layout/EmptyLinesAroundBlockBody',
    'Layout/EmptyLinesAroundClassBody',
    'Layout/EmptyLinesAroundMethodBody',
    'Layout/EmptyLinesAroundModuleBody',
    'Layout/TrailingWhitespace',
    'Style/EmptyMethod',
    'Style/TrailingCommaInArguments',
  ]

  rules.each do |rule|
    `bundle exec rubocop --auto-correct --only #{rule}`
  end

  Rake::Task['rubocop'].invoke
end

require "rubocop/rake_task"
RuboCop::RakeTask.new

### TODO: Allow rubocop to fail, but still continue
desc "Default: run all available test suites"
task default: %i[prepare test spec]

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
paper_trail-association_tracking-2.0.0 Rakefile
paper_trail-association_tracking-1.1.1 Rakefile
paper_trail-association_tracking-1.1.0 Rakefile
paper_trail-association_tracking-1.0.0 Rakefile
paper_trail-association_tracking-0.0.1 Rakefile