2019-05-22 08:16:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
return if Rails.env.production?
|
|
|
|
|
2021-04-15 02:09:30 -04:00
|
|
|
require_relative '../../tooling/merge_request_rspec_failure_rake_task'
|
|
|
|
|
2014-04-11 15:45:56 -04:00
|
|
|
namespace :spec do
|
2019-05-22 08:16:49 -04:00
|
|
|
desc 'GitLab | RSpec | Run unit tests'
|
|
|
|
RSpec::Core::RakeTask.new(:unit, :rspec_opts) do |t, args|
|
2021-03-31 17:09:15 -04:00
|
|
|
require_test_level
|
2019-05-22 08:16:49 -04:00
|
|
|
t.pattern = Quality::TestLevel.new.pattern(:unit)
|
|
|
|
t.rspec_opts = args[:rspec_opts]
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | RSpec | Run integration tests'
|
|
|
|
RSpec::Core::RakeTask.new(:integration, :rspec_opts) do |t, args|
|
2021-03-31 17:09:15 -04:00
|
|
|
require_test_level
|
2019-05-22 08:16:49 -04:00
|
|
|
t.pattern = Quality::TestLevel.new.pattern(:integration)
|
|
|
|
t.rspec_opts = args[:rspec_opts]
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | RSpec | Run system tests'
|
|
|
|
RSpec::Core::RakeTask.new(:system, :rspec_opts) do |t, args|
|
2021-03-31 17:09:15 -04:00
|
|
|
require_test_level
|
2019-05-22 08:16:49 -04:00
|
|
|
t.pattern = Quality::TestLevel.new.pattern(:system)
|
|
|
|
t.rspec_opts = args[:rspec_opts]
|
|
|
|
end
|
|
|
|
|
2021-04-15 02:09:30 -04:00
|
|
|
desc 'GitLab | RSpec | Run merge request RSpec failures'
|
|
|
|
Tooling::MergeRequestRspecFailureRakeTask.new(:merge_request_rspec_failure, :rspec_opts) do |t, args|
|
|
|
|
t.pattern = t.rspec_failures_on_merge_request
|
|
|
|
t.rspec_opts = args[:rspec_opts]
|
|
|
|
end
|
|
|
|
|
2019-07-23 16:39:11 -04:00
|
|
|
desc 'Run the code examples in spec/requests/api'
|
|
|
|
RSpec::Core::RakeTask.new(:api) do |t|
|
|
|
|
t.pattern = 'spec/requests/api/**/*_spec.rb'
|
2014-03-14 04:44:16 -04:00
|
|
|
end
|
2021-03-31 17:09:15 -04:00
|
|
|
|
2021-04-15 02:09:30 -04:00
|
|
|
private
|
|
|
|
|
2021-03-31 17:09:15 -04:00
|
|
|
def require_test_level
|
|
|
|
require_relative '../../tooling/quality/test_level'
|
|
|
|
end
|
2014-03-14 04:44:16 -04:00
|
|
|
end
|