596596 ] } } )
597597 end
598598 end
599+
600+ it "__channel__channel|encoded::1___max__5___http_sync__true___callback__nil_" do
601+ VCR . use_cassette ( "examples/fetch_messages/encoded_channels" , :record => :once ) do
602+ channel = "channel|encoded::1"
603+ envelope = @pubnub . fetch_messages ( channel : channel , max : 5 , http_sync : true )
604+ expect ( envelope . is_a? ( Pubnub ::Envelope ) ) . to eq true
605+ expect ( envelope . error? ) . to eq false
606+
607+ expect ( envelope . status [ :code ] ) . to eq ( 200 )
608+ expect ( envelope . status [ :category ] ) . to eq ( :ack )
609+ expect ( envelope . status [ :config ] ) . to eq ( { :tls => false , :uuid => "ruby-test-uuid-client-one" , :auth_key => "ruby-test-auth-client-one" , :origin => "ps.pndsn.com" } )
610+
611+ expect ( envelope . result [ :code ] ) . to eq ( 200 )
612+ expect ( envelope . result [ :operation ] ) . to eq ( :fetch_messages )
613+ expect ( envelope . result [ :data ] ) . to eq ( {
614+ :channels => {
615+ "channel%7Cencoded%3A%3A1" => [
616+ {
617+ "message_type" => nil ,
618+ "message" => "Hello test world" ,
619+ "timetoken" => "17575837829949324" ,
620+ "uuid" => "ruby-test-uuid-client-one"
621+ }
622+ ]
623+ }
624+ } )
625+ end
626+ end
627+
628+ it "__channel__channel|encoded::2___max__5___encode_channels__false___http_sync__true___callback__nil_" do
629+ VCR . use_cassette ( "examples/fetch_messages/not_encoded_channels" , :record => :once ) do
630+ channel = "channel|encoded::2"
631+ envelope = @pubnub . fetch_messages ( channel : channel , max : 5 , encode_channels : false , http_sync : true )
632+ expect ( envelope . is_a? ( Pubnub ::Envelope ) ) . to eq true
633+ expect ( envelope . error? ) . to eq false
634+
635+ expect ( envelope . status [ :code ] ) . to eq ( 200 )
636+ expect ( envelope . status [ :category ] ) . to eq ( :ack )
637+ expect ( envelope . status [ :config ] ) . to eq ( { :tls => false , :uuid => "ruby-test-uuid-client-one" , :auth_key => "ruby-test-auth-client-one" , :origin => "ps.pndsn.com" } )
638+
639+ expect ( envelope . result [ :code ] ) . to eq ( 200 )
640+ expect ( envelope . result [ :operation ] ) . to eq ( :fetch_messages )
641+ expect ( envelope . result [ :data ] ) . to eq ( {
642+ :channels => {
643+ "channel|encoded::2" => [
644+ {
645+ "message_type" => nil ,
646+ "message" => "Hello test world" ,
647+ "timetoken" => "17575842502404510" ,
648+ "uuid" => "ruby-test-uuid-client-one" ,
649+ }
650+ ]
651+ }
652+ } )
653+ end
654+ end
599655end
0 commit comments