Skip to content

Commit bfc24dd

Browse files
authored
Add documentation for running tests and configuring API keys (#300)
1 parent d9ccabc commit bfc24dd

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

bin/test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ end
88

99
ENV["RAILS_ENV"] = "test"
1010

11+
# Default to rails8.gemfile for local development.
12+
# CI overrides this via BUNDLE_GEMFILE env var to test against multiple Rails versions.
13+
# See gemfiles/ directory and .github/workflows/ci.yml for available configurations.
14+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../gemfiles/rails8.gemfile", __dir__)
1115
require "bundler/setup"
1216

1317
$LOAD_PATH.unshift File.expand_path("../test", __dir__)

docs/contributing/documentation.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,49 @@ To document a new feature:
3030
3. Import test regions into documentation
3131
4. Preview locally with `bin/docs`
3232

33+
## Running Tests
34+
35+
### Prerequisites
36+
37+
Install dependencies:
38+
39+
```bash
40+
bundle install
41+
```
42+
43+
### Running the Test Suite
44+
45+
```bash
46+
bin/test
47+
```
48+
49+
This uses `gemfiles/rails8.gemfile` by default. To test against other Rails versions:
50+
51+
```bash
52+
BUNDLE_GEMFILE=gemfiles/rails7.gemfile bundle install
53+
BUNDLE_GEMFILE=gemfiles/rails7.gemfile bin/test
54+
```
55+
56+
See `gemfiles/` for available configurations.
57+
58+
### API Keys
59+
60+
Most tests use VCR cassettes (recorded HTTP responses), so they run without API credentials. You only need API keys when:
61+
62+
- Re-recording VCR cassettes
63+
- Running tests against live APIs
64+
- Adding tests for new API interactions
65+
66+
To set API keys, create `.env.test` in the project root:
67+
68+
```bash
69+
OPENAI_API_KEY=your_key_here
70+
ANTHROPIC_API_KEY=your_key_here
71+
OPEN_ROUTER_API_KEY=your_key_here
72+
```
73+
74+
Or export them in your shell before running tests.
75+
3376
## How It Works
3477

3578
### VitePress Code Imports

0 commit comments

Comments
 (0)