2014-04-11 15:45:56 -04:00
|
|
|
Rake::Task["spec"].clear if Rake::Task.task_defined?('spec')
|
2014-04-11 07:31:37 -04:00
|
|
|
|
2014-04-11 15:45:56 -04:00
|
|
|
namespace :spec do
|
2015-06-23 10:48:52 -04:00
|
|
|
desc 'GitLab | Rspec | Run request specs'
|
2014-04-11 15:45:56 -04:00
|
|
|
task :api do
|
2014-04-11 07:31:37 -04:00
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
2014-04-11 15:45:56 -04:00
|
|
|
%W(rspec spec --tag @api)
|
2014-04-11 07:31:37 -04:00
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
2014-03-14 04:44:16 -04:00
|
|
|
|
2015-06-23 10:48:52 -04:00
|
|
|
desc 'GitLab | Rspec | Run feature specs'
|
2014-04-12 04:56:37 -04:00
|
|
|
task :feature do
|
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
|
|
|
%W(rspec spec --tag @feature)
|
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
|
|
|
|
2015-12-09 04:51:01 -05:00
|
|
|
desc 'GitLab | Rspec | Run model specs'
|
|
|
|
task :models do
|
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
|
|
|
%W(rspec spec --tag @models)
|
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
|
|
|
|
2015-12-09 05:56:23 -05:00
|
|
|
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
|
|
|
|
|
2015-10-02 11:00:23 -04:00
|
|
|
desc 'GitLab | Rspec | Run benchmark specs'
|
|
|
|
task :benchmark do
|
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
|
|
|
%W(rspec spec --tag @benchmark)
|
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
|
|
|
|
2015-06-23 10:48:52 -04:00
|
|
|
desc 'GitLab | Rspec | Run other specs'
|
2014-04-11 07:31:37 -04:00
|
|
|
task :other do
|
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
2015-12-09 05:56:23 -05:00
|
|
|
%W(rspec spec --tag ~@api --tag ~@feature --tag ~@models --tag ~@lib --tag ~@services --tag ~@benchmark)
|
2014-04-11 07:31:37 -04:00
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
2014-04-11 15:45:56 -04:00
|
|
|
end
|
|
|
|
|
2015-06-23 10:48:52 -04:00
|
|
|
desc "GitLab | Run specs"
|
2014-04-11 15:45:56 -04:00
|
|
|
task :spec do
|
|
|
|
cmds = [
|
|
|
|
%W(rake gitlab:setup),
|
2015-10-05 12:01:28 -04:00
|
|
|
%W(rspec spec --tag ~@benchmark),
|
2014-04-11 15:45:56 -04:00
|
|
|
]
|
|
|
|
run_commands(cmds)
|
|
|
|
end
|
2014-03-14 04:44:16 -04:00
|
|
|
|
2014-04-11 15:45:56 -04:00
|
|
|
def run_commands(cmds)
|
|
|
|
cmds.each do |cmd|
|
2014-05-27 01:12:03 -04:00
|
|
|
system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) or raise("#{cmd} failed!")
|
2014-03-14 04:44:16 -04:00
|
|
|
end
|
|
|
|
end
|