Skip to content

Commit

Permalink
feat(appraisal): resolve appraisal name
Browse files Browse the repository at this point in the history
  • Loading branch information
marian13 committed Sep 14, 2022
1 parent 7ac2cb4 commit 5e5d146
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# frozen_string_literal: true

##
# NOTE: Appraisal sets `BUNDLE_GEMFILE' env variable.
# This is how appraisals can be differentiated from each other.
# https://github.com/thoughtbot/appraisal/blob/v2.4.1/lib/appraisal/command.rb#L36
#
# If `BUNDLE_GEMFILE' is an empty string, then `APPRAISAL_NAME' is resolved to an empty string as well.
# User passed `APPRAISAL_NAME' has a precedence.
#
# IMPORTANT: `APPRAISAL_NAME' env variable should be initialized as far as it is possible.
#
ENV["APPRAISAL_NAME"] ||= ENV["BUNDLE_GEMFILE"].to_s.then(&File.method(:basename)).then { |name| name.end_with?(".gemfile") ? name.delete_suffix(".gemfile") : "" }

require_relative "coverage_helper"

require "bundler/setup"
Expand Down

0 comments on commit 5e5d146

Please sign in to comment.