Rename Push to PushTarget for better readability

PushTarget#push reads more naturally than Push#push. The push target
is the thing that pushes notifications to a specific destination.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Rosa Gutierrez
2026-01-21 19:41:34 +01:00
parent 06c9ece058
commit b5205ce6b2
9 changed files with 37 additions and 38 deletions
@@ -1,6 +1,6 @@
require "test_helper"
class Notification::Push::NativeTest < ActiveSupport::TestCase
class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
setup do
@user = users(:kevin)
@identity = @user.identity
@@ -14,7 +14,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
notification = notifications(:logo_assignment_kevin)
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(notification)
push = Notification::PushTarget::Native.new(notification)
assert_equal "assignment", push.send(:notification_category)
end
@@ -23,7 +23,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
notification = notifications(:layout_commented_kevin)
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(notification)
push = Notification::PushTarget::Native.new(notification)
assert_equal "comment", push.send(:notification_category)
end
@@ -32,7 +32,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
notification = notifications(:logo_card_david_mention_by_jz)
notification.user.identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(notification)
push = Notification::PushTarget::Native.new(notification)
assert_equal "mention", push.send(:notification_category)
end
@@ -40,7 +40,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "notification_category returns card for other card events" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
assert_equal "card", push.send(:notification_category)
end
@@ -49,7 +49,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
notification = notifications(:logo_assignment_kevin)
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(notification)
push = Notification::PushTarget::Native.new(notification)
assert_equal "time-sensitive", push.send(:interruption_level)
end
@@ -57,7 +57,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "interruption_level is active for non-assignments" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
assert_equal "active", push.send(:interruption_level)
end
@@ -67,7 +67,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
assert_native_push_delivery(count: 1) do
Notification::Push::Native.new(@notification).push
Notification::PushTarget::Native.new(@notification).push
end
end
@@ -75,7 +75,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
@identity.devices.delete_all
assert_no_native_push_delivery do
Notification::Push::Native.new(@notification).push
Notification::PushTarget::Native.new(@notification).push
end
end
@@ -85,7 +85,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
@notification.update!(creator: users(:system))
assert_no_native_push_delivery do
Notification::Push::Native.new(@notification).push
Notification::PushTarget::Native.new(@notification).push
end
end
@@ -96,14 +96,14 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
@identity.devices.create!(token: "token2", platform: "google", name: "Pixel")
assert_native_push_delivery(count: 2) do
Notification::Push::Native.new(@notification).push
Notification::PushTarget::Native.new(@notification).push
end
end
test "native notification includes required fields" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_not_nil native.title
@@ -114,7 +114,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "native notification sets thread_id from card" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_equal @notification.card.id, native.thread_id
@@ -124,7 +124,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
notification = notifications(:logo_assignment_kevin)
notification.user.identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(notification)
push = Notification::PushTarget::Native.new(notification)
native = push.send(:native_notification)
assert native.high_priority
@@ -133,7 +133,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "native notification sets normal priority for non-assignments" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_not native.high_priority
@@ -142,7 +142,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "native notification includes apple-specific fields" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_equal 1, native.apple_data.dig(:aps, :"mutable-content")
@@ -153,7 +153,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "native notification sets android notification to nil for data-only" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_nil native.google_data.dig(:android, :notification)
@@ -162,7 +162,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "native notification includes data payload" do
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
push = Notification::Push::Native.new(@notification)
push = Notification::PushTarget::Native.new(@notification)
native = push.send(:native_notification)
assert_not_nil native.data[:url]
@@ -172,7 +172,7 @@ class Notification::Push::NativeTest < ActiveSupport::TestCase
test "push_later enqueues Notification::NativePushJob" do
assert_enqueued_with(job: Notification::NativePushJob, args: [ @notification ]) do
Notification::Push::Native.push_later(@notification)
Notification::PushTarget::Native.push_later(@notification)
end
end
end