summaryrefslogtreecommitdiff
path: root/lib/tasks/spec.rake
blob: 1f6ceca80bd44c9258da4f61786e4cf5747ba1fb (plain)
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
namespace :testing do
  desc 'GITLAB | Run model specs'
  task :models do
    cmds = [
      %W(rake gitlab:setup),
      %W(rspec spec --tag @models)
    ]
    run_commands(cmds)
  end

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

  desc 'GITLAB | Run other specs'
  task :other do
    cmds = [
      %W(rake gitlab:setup),
      %W(rspec spec --tag ~@models --tag ~@features)
    ]
    run_commands(cmds)
  end

  def run_commands(cmds)
    cmds.each do |cmd|
      system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd)
      raise "#{cmd} failed!" unless $?.exitstatus.zero?
    end
  end
end