File: ruby-tests.rake

package info (click to toggle)
ruby-bluefeather 0.41-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 736 kB
  • sloc: ruby: 4,195; makefile: 9
file content (41 lines) | stat: -rw-r--r-- 948 bytes parent folder | download | duplicates (5)
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
38
39
40
41
require 'gem2deb/rake/testtask'
require 'rspec/core/rake_task'
require 'fileutils'
# task 'default' => [:spec, 'original-test']
task 'default' => :spec

Rake::TestTask.new('original-test') do |tasklib|
  tasklib.test_files = FileList['original-tests/*.tests.rb']
end


task_cls = RSpec::Core::RakeTask
rspec_opts_setting_proc = proc do |task|
  task.rspec_opts = ['-fs']
end
# Proc for initializing each spec-tasks by common parameters
setting = proc do |st|
  st.ruby_opts = %w(-Ku)
end
desc "Verify all spec files."
task_cls.new do |st|
  setting.call(st)
  st.pattern = 'spec/*.rb'
end

desc "Verify all spec files with specdocs."
task_cls.new(:specd) do |st|
  setting.call(st)
  rspec_opts_setting_proc.call(st)
  st.pattern = 'spec/*.rb'
end

namespace :spec do
  Dir.glob('spec/*.rb') do |path|
    desc "Verify '#{path}'"
    task_cls.new(File.basename(path, '.rb')) do |st|
      setting.call(st)
      st.pattern = path
    end
  end
end