Skip to content

Commit

Permalink
limited length of title and author
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Jul 30, 2021
1 parent 7a0fcb3 commit 73fd511
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tasks/alma_circ_history.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace :alma_circ_history do
loan = Loan.new do |l|
l.user = u
l.id = row["Item Loan Id"]
l.title = row["Title"]
l.author = row["Author"]
l.title = row["Title"][0,255]
l.author = row["Author"][0,255]
l.mms_id = row["MMS Id"]
l.return_date = row["Return Date"]
l.checkout_date = row["Loan Date"]
Expand Down
22 changes: 22 additions & 0 deletions spec/tasks/alma_circ_history_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@
expect(User.all.count).to eq(2)
expect(Loan.all.count).to eq(1)
end
it "handles giant title" do
user_ajones
user_emcard
loans = File.read('./spec/fixtures/circ_history.json')
super_long_title = 'a'*1000
loans.gsub!('Between the world and me',super_long_title)
@stub.to_return(body: loans, headers: {content_type: 'application/json'})
@stub.response #clear out original response
load_circ_history
expect(Loan.all.count).to eq(2)
end
it "handles giant author" do
user_ajones
user_emcard
loans = File.read('./spec/fixtures/circ_history.json')
super_long_author = 'a'*1000
loans.gsub!('Caldwell, John, 1938-',super_long_author)
@stub.to_return(body: loans, headers: {content_type: 'application/json'})
@stub.response #clear out original response
load_circ_history
expect(Loan.all.count).to eq(2)
end

end
describe "alma_circ_history:purge" do
Expand Down

0 comments on commit 73fd511

Please sign in to comment.