-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathspec_helper.rb
More file actions
46 lines (39 loc) · 1.91 KB
/
spec_helper.rb
File metadata and controls
46 lines (39 loc) · 1.91 KB
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
40
41
42
43
44
45
46
# frozen_string_literal: true
ENV['HATCHET_BUILDPACK_BASE'] ||= 'https://github.com/heroku/heroku-buildpack-python.git'
ENV['HATCHET_DEFAULT_STACK'] ||= 'heroku-22'
require 'rspec/core'
require 'hatchet'
LATEST_PYTHON_3_6 = '3.6.15'
LATEST_PYTHON_3_7 = '3.7.16'
LATEST_PYTHON_3_8 = '3.8.16'
LATEST_PYTHON_3_9 = '3.9.16'
LATEST_PYTHON_3_10 = '3.10.10'
LATEST_PYTHON_3_11 = '3.11.2'
DEFAULT_PYTHON_VERSION = LATEST_PYTHON_3_11
# Work around the return value for `default_buildpack` changing after deploy:
# https://github.com/heroku/hatchet/issues/180
# Once we've updated to Hatchet release that includes the fix, consumers
# of this can switch back to using `app.class.default_buildpack`
DEFAULT_BUILDPACK_URL = Hatchet::App.default_buildpack
RSpec.configure do |config|
# Disables the legacy rspec globals and monkey-patched `should` syntax.
config.disable_monkey_patching!
# Enable flags like --only-failures and --next-failure.
config.example_status_persistence_file_path = '.rspec_status'
# Allows limiting a spec run to individual examples or groups by tagging them
# with `:focus` metadata via the `fit`, `fcontext` and `fdescribe` aliases.
config.filter_run_when_matching :focus
# Allows declaring on which stacks a test/group should run by tagging it with `stacks`.
config.filter_run_excluding stacks: ->(stacks) { !stacks.include?(ENV.fetch('HATCHET_DEFAULT_STACK')) }
end
def clean_output(output)
# Remove trailing whitespace characters added by Git:
# https://github.com/heroku/hatchet/issues/162
output.gsub(/ {8}(?=\R)/, '')
end
def update_buildpacks(app, buildpacks)
# Updates the list of buildpacks for an existing app, until Hatchet supports this natively:
# https://github.com/heroku/hatchet/issues/166
buildpack_list = buildpacks.map { |b| { buildpack: (b == :default ? DEFAULT_BUILDPACK_URL : b) } }
app.api_rate_limit.call.buildpack_installation.update(app.name, updates: buildpack_list)
end