@@ -42,7 +42,7 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
42
42
subscribe_as_queue ( "channel" ) do |queue |
43
43
@tx_adapter . broadcast ( "channel" , "hello world" )
44
44
45
- assert_equal "hello world" , queue . pop
45
+ assert_equal "hello world" , next_message_in_queue ( queue )
46
46
end
47
47
end
48
48
@@ -53,7 +53,7 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
53
53
54
54
@tx_adapter . broadcast ( "channel" , "hello world" )
55
55
56
- assert_equal "hello world" , queue . pop
56
+ assert_equal "hello world" , next_message_in_queue ( queue )
57
57
end
58
58
59
59
@tx_adapter . broadcast ( "channel" , "hello void" )
@@ -84,7 +84,7 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
84
84
@tx_adapter . broadcast ( "channel" , "apples" )
85
85
86
86
received = [ ]
87
- 2 . times { received << queue . pop }
87
+ 2 . times { received << next_message_in_queue ( queue ) }
88
88
assert_equal %w( apples bananas ) , received . sort
89
89
end
90
90
end
@@ -94,10 +94,10 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
94
94
subscribe_as_queue ( "channel" ) do |queue_2 |
95
95
@tx_adapter . broadcast ( "channel" , "hello" )
96
96
97
- assert_equal "hello" , queue_2 . pop
97
+ assert_equal "hello" , next_message_in_queue ( queue_2 )
98
98
end
99
99
100
- assert_equal "hello" , queue . pop
100
+ assert_equal "hello" , next_message_in_queue ( queue )
101
101
end
102
102
end
103
103
@@ -107,8 +107,8 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
107
107
@tx_adapter . broadcast ( "channel" , "apples" )
108
108
@tx_adapter . broadcast ( "other channel" , "oranges" )
109
109
110
- assert_equal "apples" , queue . pop
111
- assert_equal "oranges" , queue_2 . pop
110
+ assert_equal "apples" , next_message_in_queue ( queue )
111
+ assert_equal "oranges" , next_message_in_queue ( queue_2 )
112
112
end
113
113
end
114
114
end
@@ -118,7 +118,7 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
118
118
@tx_adapter . broadcast ( "other channel" , "one" )
119
119
@tx_adapter . broadcast ( "channel" , "two" )
120
120
121
- assert_equal "two" , queue . pop
121
+ assert_equal "two" , next_message_in_queue ( queue )
122
122
end
123
123
end
124
124
@@ -130,8 +130,8 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
130
130
@tx_adapter . broadcast ( channel_1 , "apples" )
131
131
@tx_adapter . broadcast ( channel_2 , "oranges" )
132
132
133
- assert_equal "apples" , queue . pop
134
- assert_equal "oranges" , queue_2 . pop
133
+ assert_equal "apples" , next_message_in_queue ( queue )
134
+ assert_equal "oranges" , next_message_in_queue ( queue_2 )
135
135
end
136
136
end
137
137
end
@@ -142,7 +142,7 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
142
142
subscribe_as_queue ( "channel" ) do |queue |
143
143
@tx_adapter . broadcast ( "channel" , "hello world" )
144
144
145
- assert_equal "hello world" , queue . pop
145
+ assert_equal "hello world" , next_message_in_queue ( queue )
146
146
end
147
147
end
148
148
end
@@ -163,8 +163,8 @@ class ActionCable::SubscriptionAdapter::SolidCableTest < ActionCable::TestCase
163
163
subscribe_as_queue ( "other" ) do |other_queue |
164
164
assert_empty other_queue
165
165
end
166
- assert_equal "channel3" , queue . pop
167
- assert_equal "channel4" , queue . pop
166
+ assert_equal "channel3" , next_message_in_queue ( queue )
167
+ assert_equal "channel4" , next_message_in_queue ( queue )
168
168
end
169
169
170
170
@tx_adapter . broadcast ( "channel" , "channel5" )
@@ -206,4 +206,12 @@ def with_active_record_logger(logger)
206
206
ensure
207
207
ActiveRecord ::Base . logger = old_logger
208
208
end
209
+
210
+ def next_message_in_queue ( queue )
211
+ if queue . empty?
212
+ raise "Queue is empty"
213
+ else
214
+ queue . pop
215
+ end
216
+ end
209
217
end
0 commit comments