Skip to content

Commit

Permalink
Merge pull request #4069 from DataDog/run-appraisal
Browse files Browse the repository at this point in the history
Use BUNDLE_GEMFILE directly instead of appraisal binary
  • Loading branch information
TonyCTHsu authored Nov 5, 2024
2 parents b6d746e + 8f1220b commit b3a00f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ namespace :test do
command = if appraisal_group.empty?
"bundle exec rake #{spec_task}"
else
"bundle exec appraisal #{ruby_runtime}-#{appraisal_group} rake #{spec_task}"
gemfile = File.join(File.dirname(__FILE__), 'gemfiles', "#{ruby_runtime}-#{appraisal_group}.gemfile".tr('-', '_'))
"env BUNDLE_GEMFILE=#{gemfile} bundle exec rake #{spec_task}"
end

command += "'[#{spec_arguments}]'" if spec_arguments
Expand Down
18 changes: 18 additions & 0 deletions docs/DevelopmentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,24 @@ TEST_METADATA = {
}
```

**Using appraisal**

`appraisal` command should only be used to update gemfiles in `gemfiles/`
and install dependencies. It should not be used to run tests, since it does not
work in all configurations. To run the tests, use:

```sh
env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime}_#{appraisal_group}.gemfile rake #{spec_task}
```

Note that the file names use underscores while appraisal group and
configuration definitions use dashes. The conversion could be performed as
follows:

```sh
env BUNDLE_GEMFILE=gemfiles/#{ruby_runtime.tr('-', '_')}_#{appraisal_group.tr('-', '_')}.gemfile rake #{spec_task}
```

**Working with appraisal groups**

Checkout [Apppraisal](https://github.com/thoughtbot/appraisal) to learn the basics.
Expand Down

0 comments on commit b3a00f4

Please sign in to comment.