1
+ require "test_helper"
2
+
3
+ class ActiveJob ::QueueTest < ActiveSupport ::TestCase
4
+ test "to_param returns parameterized queue name" do
5
+ queue = ActiveJob ::Queue . new ( "MixedCaseQueue" )
6
+ assert_equal "mixedcasequeue" , queue . to_param
7
+ end
8
+
9
+ test "to_param handles queue names with special characters" do
10
+ queue = ActiveJob ::Queue . new ( "My-Queue_With.Special@Chars!" )
11
+ assert_equal "my-queue_with-special-chars" , queue . to_param
12
+ end
13
+
14
+ test "to_param handles queue names with spaces" do
15
+ queue = ActiveJob ::Queue . new ( "My Queue With Spaces" )
16
+ assert_equal "my-queue-with-spaces" , queue . to_param
17
+ end
18
+
19
+ test "to_param handles queue names with underscores" do
20
+ queue = ActiveJob ::Queue . new ( "my_queue_with_underscores" )
21
+ assert_equal "my_queue_with_underscores" , queue . to_param
22
+ end
23
+
24
+ test "to_param handles queue names with numbers" do
25
+ queue = ActiveJob ::Queue . new ( "Queue123With456Numbers" )
26
+ assert_equal "queue123with456numbers" , queue . to_param
27
+ end
28
+
29
+ test "id is an alias for to_param" do
30
+ queue = ActiveJob ::Queue . new ( "MixedCaseQueue" )
31
+ assert_equal queue . to_param , queue . id
32
+ end
33
+
34
+ test "queue lookup by id works correctly" do
35
+ # Create a queue with a mixed case name
36
+ queue = ActiveJob ::Queue . new ( "MixedCaseQueue" )
37
+ queues = ActiveJob ::Queues . new ( [ queue ] )
38
+
39
+ # Should find the queue by its parameterized id
40
+ assert_equal queue , queues . find { |q | q . id == "mixedcasequeue" }
41
+
42
+ # Should find the queue by its original name
43
+ assert_equal queue , queues [ "MixedCaseQueue" ]
44
+ end
45
+ end
0 commit comments