File: Rakefile

package info (click to toggle)
ruby-beaker-hostgenerator 1.1.22-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,804 kB
  • sloc: ruby: 2,840; makefile: 3
file content (57 lines) | stat: -rw-r--r-- 1,329 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'rspec/core/rake_task'
require 'rake/testtask'

namespace :test do

  namespace :spec do

    task :minitest do
      desc "Run minitest tests"
      Rake::TestTask.new do |task|
        task.libs << %w(test lib)
        task.test_files = FileList['test/test*.rb']
        task.verbose = true
      end
    end

    desc "Run spec tests"
    RSpec::Core::RakeTask.new(:run) do |t|
      t.rspec_opts = ['--color']
      t.pattern = 'spec/'
      t.ruby_opts = '-Itest'
    end

    desc "Run spec tests with coverage"
    RSpec::Core::RakeTask.new(:coverage) do |t|
      ENV['BEAKER_TEMPLATE_COVERAGE'] = 'y'
      t.rspec_opts = ['--color']
      t.pattern = 'spec/'
    end

  end

end

namespace :generate do
  desc "Generate test fixtures."
  task :fixtures do
    $LOAD_PATH.unshift(
      File.join(Dir.pwd, 'lib'),
      File.join(Dir.pwd, 'test')
    )
    require 'beaker-hostgenerator'
    require 'util/generator_helpers'

    fixgen = FixtureGenerator.new
    fixgen.generate
  end
end

# namespace-named default tasks.
# these are the default tasks invoked when only the namespace is referenced.
# they're needed because `task :default` in those blocks doesn't work as expected.
task 'test:spec' => ['test:spec:run', 'test:spec:minitest']

# global defaults
task :test => 'test:spec'
task :default => :test