summaryrefslogtreecommitdiff
path: root/lib/tasks/spinach.rake
blob: 3acfc6e207505317c3c494960d2bfdd78dce41d4 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Rake::Task["spinach"].clear if Rake::Task.task_defined?('spinach')

namespace :spinach do
  namespace :project do
    desc "GitLab | Spinach | Run project commits, issues and merge requests spinach features"
    task :half do
      cmds = [
        %W(rake gitlab:setup),
        %W(spinach --tags @project_commits,@project_issues,@project_merge_requests),
      ]
      run_commands(cmds)
    end

    desc "GitLab | Spinach | Run remaining project spinach features"
    task :rest do
      cmds = [
        %W(rake gitlab:setup),
        %W(spinach --tags ~@admin,~@dashboard,~@profile,~@public,~@snippets,~@project_commits,~@project_issues,~@project_merge_requests),
      ]
      run_commands(cmds)
    end
  end

  desc "GitLab | Spinach | Run project spinach features"
  task :project do
    cmds = [
      %W(rake gitlab:setup),
      %W(spinach --tags ~@admin,~@dashboard,~@profile,~@public,~@snippets),
    ]
    run_commands(cmds)
  end

  desc "GitLab | Spinach | Run other spinach features"
  task :other do
    cmds = [
      %W(rake gitlab:setup),
      %W(spinach --tags @admin,@dashboard,@profile,@public,@snippets),
    ]
    run_commands(cmds)
  end
end

desc "GitLab | Run spinach"
task :spinach do
  cmds = [
    %W(rake gitlab:setup),
    %W(spinach),
  ]
  run_commands(cmds)
end

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