2022-07-23 23:45:48 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
require 'zeitwerk'
|
|
|
|
require_relative 'helpers/users_helper'
|
2023-03-04 22:38:38 +05:30
|
|
|
require_relative('../../../ee/spec/contracts/provider/spec_helper') if Gitlab.ee?
|
|
|
|
require Rails.root.join("spec/support/helpers/rails_helpers.rb")
|
|
|
|
require Rails.root.join("spec/support/helpers/stub_env.rb")
|
|
|
|
|
|
|
|
# Opt out of telemetry collection. We can't allow all engineers, and users who install GitLab from source, to be
|
|
|
|
# automatically enrolled in sending data on their usage without their knowledge.
|
|
|
|
ENV['PACT_DO_NOT_TRACK'] = 'true'
|
2022-07-23 23:45:48 +05:30
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include Devise::Test::IntegrationHelpers
|
|
|
|
config.include FactoryBot::Syntax::Methods
|
|
|
|
|
|
|
|
config.before do
|
|
|
|
user = create(:user, name: Provider::UsersHelper::CONTRACT_USER_NAME).tap do |user|
|
|
|
|
user.current_sign_in_at = Time.current
|
|
|
|
end
|
|
|
|
|
|
|
|
sign_in user
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Pact.configure do |config|
|
|
|
|
config.include FactoryBot::Syntax::Methods
|
2023-03-04 22:38:38 +05:30
|
|
|
config.include RailsHelpers
|
|
|
|
config.include StubENV
|
2022-07-23 23:45:48 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
module SpecHelper
|
|
|
|
require_relative '../../../config/bundler_setup'
|
|
|
|
Bundler.require(:default)
|
|
|
|
|
|
|
|
root = File.expand_path('../', __dir__)
|
|
|
|
|
|
|
|
loader = Zeitwerk::Loader.new
|
|
|
|
loader.push_dir(root)
|
|
|
|
|
|
|
|
loader.ignore("#{root}/consumer")
|
|
|
|
loader.ignore("#{root}/contracts")
|
|
|
|
|
|
|
|
loader.collapse("#{root}/provider/spec")
|
|
|
|
|
|
|
|
loader.setup
|
|
|
|
end
|