Skip to content

Commit 4283a93

Browse files
author
David Zuckerman
committed
mocking test filename for lnbl file for tests
1 parent c9afef1 commit 4283a93

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

docker-compose.ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ services:
22
app:
33
build: !reset
44
image: ${DOCKER_APP_IMAGE}
5-
environment: !reset
5+
environment: !override
6+
- LBNL_FILENAME:test
67
entrypoint: ["tail", "-f", "/dev/null"]
78
volumes: !override
89
- artifacts:/opt/app/artifacts

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ services:
88
LIT_GOBI_USERNAME: "${LIT_GOBI_USERNAME}"
99
LIT_LBNL_KEY_DATA: "${LIT_LBNL_KEY_DATA}"
1010
LIT_LBNL_USERNAME: "${LIT_LBNL_USERNAME}"
11+
LBNL_FILENAME: "${LBNL_FILENAME}"
1112
init: true
1213
volumes:
1314
- ./:/opt/app

env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ LIT_GOBI_PASSWORD='password'
22
LIT_GOBI_USERNAME='username'
33
LIT_LBNL_KEY_DATA='ssh key'
44
LIT_LBNL_USERNAME='username'
5+
LBNL_FILENAME='the base name for the lbnl file'

lib/berkeley_library/sftp_handler/downloader/lbnl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module BerkeleyLibrary
66
module SftpHandler
77
module Downloader
8-
# Downloads the latest lbnl_people_yyyymmdd.zip patron file.
8+
# Downloads the latest ${LBNL_FILENAME}_yyyymmdd.zip patron file.
99
#
1010
# LBNL seems to populate this every Monday, so by default the class looks for the file
1111
# that would've been added on the most recent Monday. If today is Monday, it uses today's

spec/downloader/lbnl_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
describe '#download!' do
1111
let(:now) { Time.new(2022, 5, 25, 0, 0, 0) }
12-
let(:last_weeks_filename) { 'lbnl_people_20220516.zip' }
13-
let(:this_weeks_filename) { 'lbnl_people_20220523.zip' }
12+
let(:last_weeks_filename) { 'test_20220516.zip' }
13+
let(:this_weeks_filename) { 'test_20220523.zip' }
1414
let(:todays_remote_path) { Pathname.new(this_weeks_filename) }
1515
let(:sftp_session) { instance_double(Net::SFTP::Session) }
1616

@@ -44,7 +44,7 @@
4444
end
4545

4646
it 'downloads a specific file' do
47-
filename = 'lbnl_people_20220516.zip'
47+
filename = 'test_20220516.zip'
4848
remote_path = Pathname.new(filename)
4949
local_path = Pathname.new("/opt/app/data/#{filename}")
5050

@@ -76,31 +76,31 @@
7676
context 'on Sunday May 29, 2022' do
7777
its(:default_filename) do
7878
Timecop.freeze(Time.new(2022, 5, 29, 23, 59, 59)) do
79-
is_expected.to eq 'lbnl_people_20220523.zip'
79+
is_expected.to eq 'test_20220523.zip'
8080
end
8181
end
8282
end
8383

8484
context 'on Monday May 30, 2022' do
8585
its(:default_filename) do
8686
Timecop.freeze(Time.new(2022, 5, 30, 23, 59, 59)) do
87-
is_expected.to eq 'lbnl_people_20220530.zip'
87+
is_expected.to eq 'test_20220530.zip'
8888
end
8989
end
9090
end
9191

9292
context 'on Tuesday May 31, 2022' do
9393
its(:default_filename) do
9494
Timecop.freeze(Time.new(2022, 5, 31, 0, 0, 0)) do
95-
is_expected.to eq 'lbnl_people_20220530.zip'
95+
is_expected.to eq 'test_20220530.zip'
9696
end
9797
end
9898
end
9999

100100
context 'on Wednesday May 25, 2022' do
101101
its(:default_filename) do
102102
Timecop.freeze(Time.new(2022, 5, 25, 23, 59, 59)) do
103-
is_expected.to eq 'lbnl_people_20220523.zip'
103+
is_expected.to eq 'test_20220523.zip'
104104
end
105105
end
106106
end

0 commit comments

Comments
 (0)