BigW Consortium Gitlab

spec.rake 1.41 KB
Newer Older
1
Rake::Task["spec"].clear if Rake::Task.task_defined?('spec')
2

3
namespace :spec do
4
  desc 'GitLab | Rspec | Run request specs'
5
  task :api do
6
    cmds = [
7 8
      %w(rake gitlab:setup),
      %w(rspec spec --tag @api)
9 10 11
    ]
    run_commands(cmds)
  end
12

13
  desc 'GitLab | Rspec | Run feature specs'
14 15
  task :feature do
    cmds = [
16 17
      %w(rake gitlab:setup),
      %w(rspec spec --tag @feature)
18 19 20 21
    ]
    run_commands(cmds)
  end

Douwe Maan committed
22 23 24
  desc 'GitLab | Rspec | Run model specs'
  task :models do
    cmds = [
25 26
      %w(rake gitlab:setup),
      %w(rspec spec --tag @models)
Douwe Maan committed
27 28 29 30
    ]
    run_commands(cmds)
  end

31 32 33
  desc 'GitLab | Rspec | Run service specs'
  task :services do
    cmds = [
34 35
      %w(rake gitlab:setup),
      %w(rspec spec --tag @services)
36 37 38 39 40 41 42
    ]
    run_commands(cmds)
  end

  desc 'GitLab | Rspec | Run lib specs'
  task :lib do
    cmds = [
43 44
      %w(rake gitlab:setup),
      %w(rspec spec --tag @lib)
45 46 47 48
    ]
    run_commands(cmds)
  end

49
  desc 'GitLab | Rspec | Run other specs'
50 51
  task :other do
    cmds = [
52 53
      %w(rake gitlab:setup),
      %w(rspec spec --tag ~@api --tag ~@feature --tag ~@models --tag ~@lib --tag ~@services)
54 55 56
    ]
    run_commands(cmds)
  end
57 58
end

59
desc "GitLab | Run specs"
60 61
task :spec do
  cmds = [
62
    %w(rake gitlab:setup),
63
    %w(rspec spec)
64 65 66
  ]
  run_commands(cmds)
end
67

68 69
def run_commands(cmds)
  cmds.each do |cmd|
70
    system({ 'RAILS_ENV' => 'test', 'force' => 'yes' }, *cmd) || raise("#{cmd} failed!")
71 72
  end
end