2022-08-27 11:52:29 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
return if Rails.env.production?
|
|
|
|
|
|
|
|
require 'pact/tasks/verification_task'
|
|
|
|
|
|
|
|
provider = File.expand_path('../../../spec/contracts/provider', __dir__)
|
|
|
|
|
|
|
|
namespace :contracts do
|
2023-03-04 22:38:38 +05:30
|
|
|
require_relative "../../../spec/contracts/provider/helpers/contract_source_helper"
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
namespace :pipeline_schedules do
|
|
|
|
Pact::VerificationTask.new(:update_pipeline_schedule) do |pact|
|
2023-03-04 22:38:38 +05:30
|
|
|
pact_helper_location = "pact_helpers/project/pipeline_schedules/edit/put_edit_a_pipeline_schedule_helper.rb"
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
pact.uri(
|
2023-03-04 22:38:38 +05:30
|
|
|
Provider::ContractSourceHelper.contract_location(:rake, pact_helper_location),
|
|
|
|
pact_helper: "#{provider}/#{pact_helper_location}"
|
2022-08-27 11:52:29 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'Run all pipeline schedule contract tests'
|
|
|
|
task 'test:pipeline_schedules', :contract_pipeline_schedules do |_t, arg|
|
|
|
|
errors = %w[
|
|
|
|
update_pipeline_schedule
|
|
|
|
].each_with_object([]) do |task, err|
|
|
|
|
Rake::Task["contracts:pipeline_schedules:pact:verify:#{task}"].execute
|
|
|
|
rescue StandardError, SystemExit
|
|
|
|
err << "contracts:pipeline_schedule:pact:verify:#{task}"
|
|
|
|
end
|
|
|
|
|
|
|
|
raise StandardError, "Errors in tasks #{errors.join(', ')}" unless errors.empty?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|