Project

General

Profile

Download (1.16 KB) Statistics
| Branch: | Tag: | Revision:

foreman_docker / lib / foreman_docker / tasks / test.rake @ 8a1d63a3

1
require File.expand_path("../engine", File.dirname(__FILE__))
2
namespace :test do
3
  desc "Run the plugin unit test suite."
4
  task :docker => ['db:test:prepare'] do
5
    test_task = Rake::TestTask.new('docker_test_task') do |t|
6
      t.libs << ["test", "#{ForemanDocker::Engine.root}/test"]
7
      t.test_files = [
8
        "#{ForemanDocker::Engine.root}/test/**/*_test.rb"
9
      ]
10
      t.verbose = true
11
    end
12

    
13
    Rake::Task[test_task.name].invoke
14
  end
15
end
16

    
17
namespace :docker do
18
  task :rubocop do
19
    begin
20
      require 'rubocop/rake_task'
21
      RuboCop::RakeTask.new(:rubocop_docker) do |task|
22
        task.patterns = ["#{ForemanDocker::Engine.root}/app/**/*.rb",
23
                         "#{ForemanDocker::Engine.root}/lib/**/*.rb",
24
                         "#{ForemanDocker::Engine.root}/test/**/*.rb"]
25
      end
26
    rescue
27
      puts "Rubocop not loaded."
28
    end
29

    
30
    Rake::Task['rubocop_docker'].invoke
31
  end
32
end
33

    
34
Rake::Task[:test].enhance do
35
  Rake::Task['test:docker'].invoke
36
end
37

    
38
load 'tasks/jenkins.rake'
39
if Rake::Task.task_defined?(:'jenkins:unit')
40
  Rake::Task["jenkins:unit"].enhance do
41
    Rake::Task['test:docker'].invoke
42
    Rake::Task['docker:rubocop'].invoke
43
  end
44
end