Sha256: ea63e0245f56f51d36dea09a7b09f8f9b8e4d61361f2684d843863dc30948770

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe Pubnub::WhereNow do
  it_behaves_like "an event"

  context "given basic parameters" do
    before :each do
      @pubnub = Pubnub::Client.new(
        subscribe_key: "sub-a-mock-key",
        publish_key: "pub-a-mock-key",
        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.new
        expect(envelope.result).to satisfies_schema Pubnub::Schemas::Envelope::ResultSchema.new
      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.new
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pubnub-4.6.0 spec/lib/events/where_now_spec.rb
pubnub-4.5.0 spec/lib/events/where_now_spec.rb
pubnub-4.4.0 spec/lib/events/where_now_spec.rb
pubnub-4.3.0 spec/lib/events/where_now_spec.rb
pubnub-4.2.7 spec/lib/events/where_now_spec.rb
pubnub-4.2.6 spec/lib/events/where_now_spec.rb
pubnub-4.2.5 spec/lib/events/where_now_spec.rb
pubnub-4.2.4 spec/lib/events/where_now_spec.rb
pubnub-4.2.3 spec/lib/events/where_now_spec.rb
pubnub-4.2.2 spec/lib/events/where_now_spec.rb
pubnub-4.2.1 spec/lib/events/where_now_spec.rb
pubnub-4.2.0 spec/lib/events/where_now_spec.rb
pubnub-4.1.6 spec/lib/events/where_now_spec.rb
pubnub-4.1.5 spec/lib/events/where_now_spec.rb