Skip to content

Commit d6c69db

Browse files
committed
Add ./bin to path in .envrc
- So that the spring-ified rspec binary (and other spring binstubs) run by default - This makes tests run faster by default
1 parent 95f76c6 commit d6c69db

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.envrc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
cores=$(/usr/sbin/sysctl -n hw.logicalcpu)
22

3-
if (( cores > 8 )); then
4-
# This environment variable overrides the `parallel_test` gem's default behavior
5-
# which is to use all available logical cores.
6-
# Running with 16 cores is very slow for reasons we don't fully understand
7-
# but are probably due to lock file or disk resource contention
3+
if ((cores > 8)); then
4+
# This environment variable overrides the `parallel_test` gem's default behavior
5+
# which is to use all available logical cores.
6+
# Running with 16 cores is very slow for reasons we don't fully understand
7+
# but are probably due to lock file or disk resource contention
88

9-
export PARALLEL_TEST_PROCESSORS=8
9+
export PARALLEL_TEST_PROCESSORS=8
1010
fi
11+
12+
PATH_add bin

spec/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ CC in a background process and then forks it every time you run tests. That
128128
means that everything loaded prior to the fork doesn't need to be re-loaded
129129
every time you run tests. This can speed up tests substantially.
130130

131-
To use spring, run `./bin/rspec` in place of `rspec`. Spring should
132-
automatically watch and reload files, but you can manually stop it with
133-
`./bin/spring stop`. It will automatically start again the next time you run
134-
`./bin/rspec`.
131+
To use Spring, run `./bin/rspec` in place of the default `rspec` binary. CC's
132+
`.envrc` adds the `./bin`` directory to your PATH, so in most cases you can
133+
just run `rspec`. Spring will automatically watch and reload files, but you can
134+
manually stop it with `spring stop`. It will automatically start again
135+
the next time you run `rspec`.
135136

136137
Example performance improvement:
137138
```sh
138-
❯ multitime -n 10 bundle exec rspec spec/unit/actions/app_create_spec.rb
139+
❯ multitime -n 10 bundle exec /path/to/default/rspec spec/unit/actions/app_create_spec.rb
139140

140141
...
141142

@@ -160,6 +161,8 @@ user 0.177 0.032 0.129 0.185 0.233
160161
sys 0.103 0.014 0.078 0.107 0.126
161162
```
162163

164+
If you do not want to use Spring, you can set the `DISABLE_SPRING` environment variable.
165+
163166
#### Spork (Legacy)
164167

165168
Spork is an older implementation of the same "forking" strategy implemented by Spring.

0 commit comments

Comments
 (0)