Skip to content

Commit

Permalink
Merge pull request #6579 from samvera/abel-fix_deposited_notification…
Browse files Browse the repository at this point in the history
…_spec

Valkyrization: Fix failing tests in `deposited_notification_spec.rb`
  • Loading branch information
dlpierce authored Jan 5, 2024
2 parents 548ccd9 + 0a465c4 commit 2b62ac4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec/services/hyrax/workflow/deposited_notification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@
let(:depositor) { FactoryBot.create(:user) }
let(:to_user) { FactoryBot.create(:user) }
let(:cc_user) { FactoryBot.create(:user) }
let(:work) { FactoryBot.create(:work, user: depositor) }
let(:work) do
if Hyrax.config.disable_wings
valkyrie_create(:monograph, title: ["Test title"], depositor: depositor.user_key)
else
create(:work, user: depositor)
end
end
let(:entity) { FactoryBot.create(:sipity_entity, proxy_for: work) }
let(:comment) { double("comment", comment: 'A pleasant read') }
let(:recipients) { { 'to' => [to_user], 'cc' => [cc_user] } }
let(:expected_class) { Hyrax.config.disable_wings ? 'monographs' : 'generic_works' }

describe ".send_notification" do
it 'sends a message to all users' do # rubocop:disable RSpec/ExampleLength
expect(approver)
.to receive(:send_message)
.with(anything,
"Test title (<a href=\"/concern/generic_works/#{work.id}\">#{work.id}</a>) " \
"Test title (<a href=\"/concern/#{expected_class}/#{work.id}\">#{work.id}</a>) " \
"was approved by #{approver.user_key}. A pleasant read",
anything)
.exactly(3)
Expand Down

0 comments on commit 2b62ac4

Please sign in to comment.