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