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 7
    cmds = [
      %W(rake gitlab:setup),
8
      %W(rspec spec --tag @api)
9 10 11
    ]
    run_commands(cmds)
  end
12

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

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

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

  desc 'GitLab | Rspec | Run lib specs'
  task :lib do
    cmds = [
      %W(rake gitlab:setup),
      %W(rspec spec --tag @lib)
    ]
    run_commands(cmds)
  end

49
  desc 'GitLab | Rspec | Run other specs'
50 51 52
  task :other do
    cmds = [
      %W(rake gitlab:setup),
53
      %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 62
task :spec do
  cmds = [
    %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|
Dmitriy Zaporozhets committed
70
    system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!")
71 72
  end
end