Welcome to mirror list, hosted at ThFree Co, Russian Federation.

spec_helper.rb « provider « contracts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6009d6524e115734bbeb7a0113b40ce73b695a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'
require 'zeitwerk'
require_relative 'helpers/users_helper'

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
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