diff options
Diffstat (limited to 'lib/tasks/spec.rake')
-rw-r--r-- | lib/tasks/spec.rake | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/tasks/spec.rake b/lib/tasks/spec.rake index 2cf7a25a0fd..dfe248fdb15 100644 --- a/lib/tasks/spec.rake +++ b/lib/tasks/spec.rake @@ -1,7 +1,7 @@ Rake::Task["spec"].clear if Rake::Task.task_defined?('spec') namespace :spec do - desc 'GitLab | Rspec | Run request specs' + desc 'GitLab | RSpec | Run request specs' task :api do cmds = [ %W(rake gitlab:setup), @@ -10,16 +10,17 @@ namespace :spec do run_commands(cmds) end - desc 'GitLab | Rspec | Run feature specs' - task :feature do + desc 'GitLab | RSpec | Run feature specs' + task :feature, [:split] do |task, args| cmds = [ %W(rake gitlab:setup), - %W(rspec spec --tag @feature) + %W(rspec --).concat(split_feature_specs(args[:split])) ] + run_commands(cmds) end - desc 'GitLab | Rspec | Run model specs' + desc 'GitLab | RSpec | Run model specs' task :models do cmds = [ %W(rake gitlab:setup), @@ -28,7 +29,7 @@ namespace :spec do run_commands(cmds) end - desc 'GitLab | Rspec | Run service specs' + desc 'GitLab | RSpec | Run service specs' task :services do cmds = [ %W(rake gitlab:setup), @@ -37,7 +38,7 @@ namespace :spec do run_commands(cmds) end - desc 'GitLab | Rspec | Run lib specs' + desc 'GitLab | RSpec | Run lib specs' task :lib do cmds = [ %W(rake gitlab:setup), @@ -46,7 +47,7 @@ namespace :spec do run_commands(cmds) end - desc 'GitLab | Rspec | Run other specs' + desc 'GitLab | RSpec | Run other specs' task :other do cmds = [ %W(rake gitlab:setup), @@ -70,3 +71,16 @@ def run_commands(cmds) system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!") end end + +def split_feature_specs(option = nil) + files = Dir["spec/features/**/*_spec.rb"] + count = files.length + + if option == 'first_half' + files[0...count/2] + elsif option == 'last_half' + files[count/2..-1] + else + [] + end +end |