Skip to content

Commit 1d676e9

Browse files
committed
more testing notes
1 parent cb4446e commit 1d676e9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

contributing/quickstart.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,33 @@ With your docker server running:
3535
2. You'll now be in the terminal shell - run `RAILS_ENV=test rspec`
3636
3737
You may want to consider the following options to make the test suite run faster:
38+
- Use `spring` to preload Rails with `bin/spring` - this all test runs after the first significantly faster
39+
- Set `SKIP_PRETEST_SETUP=true` in `.env.test.local` (you may need to create this file)
40+
- This will skip database pre-population with seed data, which is used by legacy tests and is not needed if you are running an isolated set of tests which only rely on factories. WE SHOULD NOT BE WRITING ANY NEW TESTS WHICH USE THE SEED DATA! Use factories instead.
3841
- Add `--fail-fast` to have the suit terminate after the first failure
3942
- Specify a folder/filename to limit how many tests get executed
4043
41-
A full command using these options would look like: `RAILS_ENV=test rspec spec/features/register_for_competition_spec.rb --fail-fast`
44+
A full command using these options would look like: `RAILS_ENV=test bin/spring rspec spec/features/register_for_competition_spec.rb --fail-fast`
4245
4346
### **RUNNING INDEPENDENTLY**
4447
```
4548
docker-compose exec wca_on_rails bash -c "RAILS_ENV=test bin/rake db:reset && RAILS_ENV=test bin/rake assets:precompile && bin/rspec"
4649
```
4750
51+
### COMMON ISSUES WITH TESTING
52+
53+
#### 1. `id not found: 333`, full error output as follows:
54+
```
55+
An error occurred while loading ./spec/models/light_result_spec.rb.
56+
Failure/Error: self.c_find(id) || raise("id not found: #{id}")
57+
58+
RuntimeError:
59+
id not found: 333
60+
```
61+
62+
Run `RAILS_ENV=test bin/rake db:reset` in your docker container - the error indicates an improperly populated database, which this command will resolve.
63+
64+
4865
----
4966
5067
[^1]: The website can also be run with `rails server` - see [Running with Rails](/guides/running_with_rails)

0 commit comments

Comments
 (0)