File: test.rake

package info (click to toggle)
nanoc 3.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,872 kB
  • ctags: 2,046
  • sloc: ruby: 16,510; makefile: 14
file content (37 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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 }

  exit MiniTest::Unit.new.run(ENV['ARGS'].split)
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'
task :test => [ :'test:all' ]