Sha256: 1248aea07a921cde7f25f55de0a442ee9b2820043d9e137f399d1c1980bff077

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

# encoding: utf-8

def run_tests(dir_glob)
  ENV['ARGS'] ||= ''
  ENV['QUIET'] ||= 'true'

  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/..'))

  # require our test helper so we don't have to in each individual test
  require 'test/helper'

  test_files = Dir["#{dir_glob}*_spec.rb"] + Dir["#{dir_glob}test_*.rb"]
  test_files.each { |f| require f }

  res = MiniTest::Unit.new.run(ENV['ARGS'].split)
  exit(res) if res != 0
end

namespace :test do
  # test:all
  desc 'Run all tests'
  task :all do
    run_tests 'test/**/'
  end

  # test:...
  %w( base cli data_sources extra filters helpers tasks ).each do |dir|
    desc "Run all #{dir} tests"
    task dir.to_sym do |_task|
      run_tests "test/#{dir}/**/"
    end
  end
end

desc 'Alias for test:all + rubocop'
task test: [:'test:all', :rubocop]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-3.7.5 tasks/test.rake