File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ def get_instance_id_info(iid_token, options = {})
162162 end
163163
164164 def send_to_topic ( topic , options = { } )
165- if topic . gsub ( TOPIC_REGEX , '' ) . zero?
165+ if topic . gsub ( TOPIC_REGEX , '' ) . length . zero?
166166 body = { 'message' : { 'topic' : topic } . merge ( options ) }
167167
168168 for_uri ( BASE_URI_V1 ) do |connection |
Original file line number Diff line number Diff line change 207207 )
208208 stub_fcm_send_to_topic_request . should have_been_made . times ( 1 )
209209 end
210+
211+ context "when topic is invalid" do
212+ let ( :topic ) { '/topics/news$' }
213+
214+ it 'should raise error' do
215+ client . send_to_topic ( topic , options )
216+ stub_fcm_send_to_topic_request . should_not have_been_requested
217+ end
218+ end
210219 end
211220
212221 describe "#send_to_topic_condition" do
You can’t perform that action at this time.
0 commit comments