-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #517 from slovensko-digital/GO-164/fs_download_sen…
…t_message_related_messages_job_fail GO-164 Make Fs::DownloadSentMessageRelatedMessagesJob fail unless related messages
- Loading branch information
Showing
5 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
test/jobs/fs/download_sent_message_related_messages_job_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "test_helper" | ||
|
||
class Fs::DownloadSentMessageRelatedMessagesJobTest < ActiveJob::TestCase | ||
test "raises error if no related messages for outbox_message" do | ||
outbox_message = messages(:fs_accountants_outbox) | ||
|
||
fs_api = Minitest::Mock.new | ||
fs_api.expect :fetch_received_messages, { | ||
"count" => 0, | ||
"messages" => [] | ||
}, | ||
**{sent_message_id: outbox_message.metadata['fs_message_id'], page: 1, count: 25, from: nil, to: nil} | ||
|
||
FsEnvironment.fs_client.stub :api, fs_api do | ||
assert_raise(StandardError, match: /No related messages!/) do | ||
Fs::DownloadSentMessageRelatedMessagesJob.new.perform(outbox_message) | ||
end | ||
end | ||
end | ||
end |