Sha256: 429ee455d382af6917f0ab5e30015a0d9d955ddf97517e338d79a8f84a75e103

Contents?: true

Size: 1.11 KB

Versions: 14

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Pubnub::Leave do
  it_behaves_like 'an event'

  around :each do |example|
    Celluloid.boot
    example.run
    Celluloid.shutdown
  end

  context 'given basic parameters' do
    before :each do
      @pubnub = Pubnub::Client.new(
          subscribe_key: 'sub-c-b7fb805a-1777-11e6-be83-0619f8945a4f',
          publish_key: 'pub-c-b42cec2f-f468-4784-8833-dd2b074538c4',
          auth_key: 'ruby-test-auth',
          uuid: 'ruby-test-uuid'
      )
    end

    it 'works' do
      VCR.use_cassette('lib/events/leave', record: :once) do
        envelope = @pubnub.leave(
            channel: :demo
        ).value

        expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
      end
    end

    it 'forms valid ErrorEnvelope on error' do
      VCR.use_cassette('lib/events/leave-error', record: :once) do
        envelope = @pubnub.leave(
            channel: :demo
        ).value

        expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
        expect(envelope.status).to satisfies_schema Pubnub::Schemas::Envelope::StatusSchema
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pubnub-4.0.27 spec/lib/events/leave_spec.rb
pubnub-4.0.25 spec/lib/events/leave_spec.rb
pubnub-4.0.23 spec/lib/events/leave_spec.rb
pubnub-4.0.22 spec/lib/events/leave_spec.rb
pubnub-4.0.21 spec/lib/events/leave_spec.rb
pubnub-4.0.20 spec/lib/events/leave_spec.rb
pubnub-4.0.19 spec/lib/events/leave_spec.rb
pubnub-4.0.18 spec/lib/events/leave_spec.rb
pubnub-4.0.17 spec/lib/events/leave_spec.rb
pubnub-4.0.16 spec/lib/events/leave_spec.rb
pubnub-4.0.15 spec/lib/events/leave_spec.rb
pubnub-4.0.14 spec/lib/events/leave_spec.rb
pubnub-4.0.13 spec/lib/events/leave_spec.rb
pubnub-4.0.12 spec/lib/events/leave_spec.rb