Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
made new_deletion_items model test more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-croswell committed Sep 16, 2019
1 parent 3783a5e commit 331838e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/models/member_institution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,26 @@
describe 'with associated work items' do
let!(:object_one) { FactoryBot.create(:intellectual_object, institution: subject) }
let!(:object_two) { FactoryBot.create(:intellectual_object, institution: subject) }
let!(:object_three) { FactoryBot.create(:intellectual_object, institution: subject) }
let!(:file_one) { FactoryBot.create(:generic_file, intellectual_object: object_one) }
let!(:file_two) { FactoryBot.create(:generic_file, intellectual_object: object_two) }
let!(:file_three) { FactoryBot.create(:generic_file, intellectual_object: object_three) }

after (:all) do
Institution.remove_directory('test')
end

it 'should return a list of new deletion items' do
latest_email = FactoryBot.create(:deletion_notification_email, institution_id: subject.id)
sleep 1
item_one = FactoryBot.create(:work_item, action: 'Delete', status: 'Success', stage: 'Resolve', generic_file: file_one, institution_id: subject.id)
item_two = FactoryBot.create(:work_item, action: 'Delete', status: 'Success', stage: 'Resolve', generic_file: file_two, institution_id: subject.id)
item_three = FactoryBot.create(:work_item, action: 'Delete', status: 'Success', stage: 'Resolve', generic_file: file_three, institution_id: subject.id)
item_three.created_at = Time.now - 2.month
item_three.save!
items = subject.new_deletion_items
items.count.should eq(2)
expect(items).to include(item_one)
expect(items).to include(item_two)
expect(items).not_to include(item_three)
end

it 'should generate a csv file for new deletion work items' do
Expand Down

0 comments on commit 331838e

Please sign in to comment.