-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
require "test_helper" | ||
|
||
class ExportJobTest < ActiveJob::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end | ||
setup do | ||
@request = "http://localhost:3000" | ||
@current_user = users(:user_001) # Assuming you have a fixture for users | ||
@query_params = { ids: [1, 2, 3] } | ||
@export_service = ExportCsvService | ||
end | ||
|
||
test "job is enqueued" do | ||
assert_enqueued_with(job: ExportJob) do | ||
ExportJob.perform_later(@request, @current_user, @query_params, @export_service) | ||
end | ||
end | ||
|
||
test "job is performed" do | ||
perform_enqueued_jobs do | ||
ExportJob.perform_later(@request, @current_user, @query_params, @export_service) | ||
end | ||
|
||
# Add assertions to verify the expected behavior | ||
# For example, check if the notification was delivered | ||
assert @current_user.notifications.any? | ||
end | ||
end |