Skip to content

Commit 0032a1a

Browse files
AP 581 - refactor stubs and job fixtures (#9)
* Refactor of stub helper and ucpath specs * Relax some cops for specs * Refactor job fixtures * Make it easier to run RSPEC via docker compose
1 parent dfd8cc1 commit 0032a1a

26 files changed

+312
-4039
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/tmp/*
77
/coverage/*
88
/artifacts/*
9+
.cache/*
910

1011
/*.xml
1112
*.zip

.rubocop.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,15 @@ Style/Lambda:
8989
Style/SingleLineBlockParams:
9090
Enabled: false
9191

92-
# For now allowing my obsesive use of OpenStructs
93-
Style/OpenStructUse:
94-
Enabled: false
95-
9692
# Rubocop hates it, but Docker is forcing the issue...
9793
Style/HashSyntax:
98-
Enabled: false
94+
Enabled: false
95+
96+
# Let's relax on some of the spec cops...they're setup heavy
97+
Metrics/MethodLength:
98+
Exclude:
99+
- 'spec/**/*'
100+
101+
Metrics/AbcSize:
102+
Exclude:
103+
- 'spec/**/*'

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,27 @@ docker build -t alma-user-load .
118118
> rspec
119119
```
120120

121+
### Run the test suite via Docker:
122+
```sh
123+
# Run rspec:
124+
> docker compose -f docker-compose.local.yml run --rm shell bundle exec rspec
125+
126+
# Run a single spec file:
127+
> docker compose -f docker-compose.local.yml run --rm shell bundle exec rspec spec/lib/ucpath_spec.rb
128+
129+
# Run a specific test (by line number)
130+
> docker compose -f docker-compose.local.yml run --rm shell bundle exec rspec spec/lib/helpers_spec.rb:34
131+
```
132+
133+
### For convenience, setup an alias:
134+
```sh
135+
# Add alias:
136+
> alias drspec='docker compose -f docker-compose.local.yml run --rm shell bundle exec rspec'
137+
138+
# Run via alias:
139+
drspec spec/lib/ucpath_spec.rb:327
140+
```
141+
121142
Note - to run the test suite you need to change the LDAP setting in your `.env` file
122143
> \# For testing:
123144
> LDAP_HOST=ldap.fake.edu
@@ -134,7 +155,6 @@ Note - to run the test suite you need to change the LDAP setting in your `.env`
134155

135156

136157
## Future Improvements:
137-
- Replace fixtures w/some sort of factory (VCR)
138158
- DRY things up (UCPath vs. SIS --> phone, email, address, names, etc...)
139159
- SIS - add run by user id (similar to how I setup ucpath)...if possible
140160
- Move 'create_user_record' from user.rb to a separate class

config/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ settings:
66
upload_host: "upload.lib.berkeley.edu"
77
upload_user: "ssullivan"
88
last_alma_purge: "2023-06-30"
9-
application_version: "1.6.6"
9+
application_version: "1.6.8"
1010

1111
# TODO - flesh this out
1212
# http://docopt.org/

docker-compose.local.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
services:
2+
shell:
3+
build:
4+
context: .
5+
target: development
6+
init: true
7+
working_dir: /opt/app
8+
volumes:
9+
- ./:/opt/app
10+
entrypoint: []

spec/data/ucpath/10000003_jobs.json

Lines changed: 0 additions & 269 deletions
This file was deleted.

0 commit comments

Comments
 (0)