Sha256: fbac1bec412aca4aa7b7cce5cdbeb9030aa923b6554d429ad65cc771a790f7e0
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' RSpec.describe Sufia::Workflow::DepositedNotification do let(:approver) { create(:user) } let(:depositor) { create(:user) } let(:to_user) { create(:user) } let(:cc_user) { create(:user) } let(:work) { create(:generic_work, user: depositor) } let(:entity) { create(:sipity_entity, proxy_for_global_id: work.to_global_id.to_s) } let(:comment) { double("comment", comment: 'A pleasant read') } let(:recipients) { { 'to' => [to_user], 'cc' => [cc_user] } } describe ".send_notification" do it 'sends a message to all users' do expect(approver).to receive(:send_message).once.and_call_original expect { described_class.send_notification(entity: entity, user: approver, comment: comment, recipients: recipients) } .to change { depositor.mailbox.inbox.count }.by(1) .and change { to_user.mailbox.inbox.count }.by(1) .and change { cc_user.mailbox.inbox.count }.by(1) end context 'without carbon-copied users' do let(:recipients) { { 'to' => [to_user] } } it 'sends a message to the to user(s)' do expect(approver).to receive(:send_message).once.and_call_original expect { described_class.send_notification(entity: entity, user: approver, comment: comment, recipients: recipients) } .to change { depositor.mailbox.inbox.count }.by(1) .and change { to_user.mailbox.inbox.count }.by(1) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sufia-7.3.0.rc3 | spec/services/sufia/workflow/deposited_notification_spec.rb |
sufia-7.3.0.rc2 | spec/services/sufia/workflow/deposited_notification_spec.rb |