Closed mwarin closed 8 months ago
I wonder if since you have the bash script broken up into functions as well as something in 'spec/data' if it would be worth using bats https://github.com/bats-core/bats-core to test that you get what you expect?
I wonder if since you have the bash script broken up into functions as well as something in 'spec/data' if it would be worth using bats https://github.com/bats-core/bats-core to test that you get what you expect?
The idea did strike me, but since we already are doing rspec and this is a pretty minor thing, can I just test it with rspec?
I wonder if since you have the bash script broken up into functions as well as something in 'spec/data' if it would be worth using bats https://github.com/bats-core/bats-core to test that you get what you expect?
The idea did strike me, but since we already are doing rspec and this is a pretty minor thing, can I just test it with rspec?
I missed that you were using rspec to test it, I think that's fine.
What/why?
Kristina wants a way to get items that change from ic->pd. Aaron and I thought it could be done using HathiFiles, so that's why the report script is here.
Kristina described this to me as a (hopefully) somewhat temporary need. If it's still being used in 2025, then we have failed.
How?
The report script is written in bash, broken down into functions, and hopefully commented enough that it's readable and understandable.
Since we already have
rspec
in this repo, I wrote a ruby test to test the bash script, as awkward as that feels.Files changed:
bin/bash_session.sh
: Utility script for starting up abash
session in thehf
service.bin/rights_change.sh
: The main payload of this PR, the report script.spec/data/rights_change_file_1.txt
andspec/data/rights_change_file_2.txt
: fixtures for testing.spec/jobs/rights_change.rb
: tests the report script, using the fixture files.How to test
hathifiles$ bash bin/bash_session.sh
/usr/src/app# bundle exec rspec spec/jobs/rights_change.rb