Skip to content

Commit

Permalink
Valkyrizes spec/services/hyrax/statistics/depositors/summary_spec.rb.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatson78 committed Dec 12, 2023
1 parent df8ba25 commit 2cf4756
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions spec/services/hyrax/statistics/depositors/summary_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@
RSpec.describe Hyrax::Statistics::Depositors::Summary, :clean_repo do
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let!(:old_work) { create(:work, user: user1) }
let(:two_days_ago_date) { Time.zone.now - 2.days }

let(:two_days_ago_date) { Time.zone.now - 2.days }
let(:start_date) { nil }
let(:end_date) { nil }
let!(:work1) { create(:work, user: user1) }
let!(:work2) { create(:work, user: user2) }
let!(:collection1) { create(:public_collection_lw, user: user1) }

if Hyrax.config.disable_wings
let!(:old_work) { valkyrie_create(:monograph, depositor: user1.user_key) }
let!(:work1) { valkyrie_create(:monograph, depositor: user1.user_key) }
let!(:work2) { valkyrie_create(:monograph, depositor: user2.user_key) }
let!(:collection1) { valkyrie_create(:hyrax_collection, :public, user: user1) }
else
let!(:old_work) { create(:work, user: user1) }
let!(:work1) { create(:work, user: user1) }
let!(:work2) { create(:work, user: user2) }
let!(:collection1) { create(:public_collection_lw, user: user1) }
end

let(:service) { described_class.new(start_date, end_date) }

before do
allow(old_work).to receive(:create_date).and_return(two_days_ago_date.to_datetime)
old_work.update_index
if Hyrax.config.disable_wings
allow(old_work).to receive(:created_at).and_return(two_days_ago_date.to_datetime)
Hyrax.index_adapter.save(resource: old_work)
else
allow(old_work).to receive(:create_date).and_return(two_days_ago_date.to_datetime)
old_work.update_index
end
end

describe '.depositors' do
Expand Down

0 comments on commit 2cf4756

Please sign in to comment.