Sha256: 3c5e72f958bab48ccf24695b1d3e388b34dc1e290ee2b578c24fea2170d391ad

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe Pubnub::WhereNow 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',
          secret_key: 'sec-c-OWIyYmVlYWYtYWMxMS00OTcxLTlhZDAtZDBlYTM4ODE1MWUy',
          auth_key: 'ruby-test-auth',
          uuid: 'ruby-test-uuid'
      )
    end
    it 'works' do
      VCR.use_cassette('lib/events/where-now', record: :once) do
        envelope = @pubnub.where_now(
            uuid: 'ruby-test'
        ).value

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

    it 'forms valid ErrorEnvelope on error' do
      VCR.use_cassette('lib/events/where-now-error', record: :once) do
        envelope = @pubnub.where_now(
            uuid: 'ruby-test'
        ).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

11 entries across 11 versions & 1 rubygems

Version Path
pubnub-4.0.9 spec/lib/events/where_now_spec.rb
pubnub-4.0.8 spec/lib/events/where_now_spec.rb
pubnub-4.0.7 spec/lib/events/where_now_spec.rb
pubnub-4.0.6 spec/lib/events/where_now_spec.rb
pubnub-4.0.5 spec/lib/events/where_now_spec.rb
pubnub-4.0.4 spec/lib/events/where_now_spec.rb
pubnub-4.0.3 spec/lib/events/where_now_spec.rb
pubnub-4.0.1 spec/lib/events/where_now_spec.rb
pubnub-4.0.0 spec/lib/events/where_now_spec.rb
pubnub-4.0.0beta2 spec/lib/events/where_now_spec.rb
pubnub-4.0.0beta1 spec/lib/events/where_now_spec.rb