Fix tests - don't test standard rails features
This commit is contained in:
@@ -37,11 +37,14 @@ class ApplicationJobTest < ActiveJob::TestCase
|
||||
end
|
||||
|
||||
assert_enqueued_jobs 1 do
|
||||
test_job.perform_later("arg1", "arg2", { key: "value" })
|
||||
test_job.perform_later("arg1", "arg2", { "key" => "value" })
|
||||
end
|
||||
|
||||
# Job class name may be nil in test environment, focus on args
|
||||
assert_equal ["arg1", "arg2", { key: "value" }], enqueued_jobs.last[:args]
|
||||
# ActiveJob serializes all hash keys as strings
|
||||
args = enqueued_jobs.last[:args]
|
||||
assert_equal "arg1", args[0]
|
||||
assert_equal "arg2", args[1]
|
||||
assert_equal "value", args[2]["key"]
|
||||
end
|
||||
|
||||
test "should have default queue configuration" do
|
||||
|
||||
@@ -107,17 +107,15 @@ class InvitationsMailerTest < ActionMailer::TestCase
|
||||
end
|
||||
|
||||
test "should have proper email headers" do
|
||||
email = @invitation_mail
|
||||
# Deliver the email first to ensure headers are set
|
||||
email = InvitationsMailer.invite_user(@user).deliver_now
|
||||
|
||||
# Test common email headers
|
||||
# Test common email headers (message_id is set on delivery)
|
||||
assert_not_nil email.message_id
|
||||
assert_not_nil email.date
|
||||
|
||||
# Test content-type
|
||||
if email.html_part
|
||||
assert_includes email.content_type, "text/html"
|
||||
elsif email.text_part
|
||||
assert_includes email.content_type, "text/plain"
|
||||
end
|
||||
# Test content-type - multipart emails contain both text and html parts
|
||||
assert_includes email.content_type, "multipart"
|
||||
assert email.html_part || email.text_part, "Should have html or text part"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user