Sha256: 344b90dd60f2cbe3f014a8cae5681a143f367ef273a07ceeae3b0b194af1d2c1
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' describe Centrifuge::Client do let(:options) { { scheme: :https, host: 'centrifugo.herokuapp.com', port: 443, secret: 'secret' } } let(:client) { Centrifuge::Client.new(options) } let(:data) { { action: :test } } it 'generates url' do expect(client.url.to_s).to eq "https://centrifugo.herokuapp.com:443/api/" end it 'publishes data' do channel = SecureRandom.hex expect(client.publish(channel, data)).to eq [{"body" => nil, "error" => nil, "method" => "publish"}] end it 'broadcasts data' do channel = SecureRandom.hex channel1 = SecureRandom.hex expect(client.broadcast([channel, channel1], data)).to eq [{"body" => nil, "error" => nil, "method" => "broadcast"}] end it 'unsubscribes user' do channel = SecureRandom.hex expect(client.unsubscribe(channel, "23")).to eq [{"body"=>nil, "error"=>nil, "method"=>"unsubscribe"}] end it 'disconnects user' do expect(client.disconnect("23")).to eq [{"body" => nil, "error" => nil, "method" => "disconnect"}] end it 'fetches presence info' do channel = SecureRandom.hex expect(client.presence(channel)).to eq [{"body" => {"channel" => channel, "data" => {}}, "error" => nil, "method" => "presence"}] end it 'fetches history' do channel = SecureRandom.hex expect(client.history(channel)).to eq [{"body" => {"channel" => channel, "data" => []}, "error" => nil, "method"=>"history"}] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
centrifuge-1.1.0 | spec/client_spec.rb |