Sha256: 5f044c0ade24bff5f57622d2fe5aadc2e96d29d8c299054852449231acc0eee5

Contents?: true

Size: 942 Bytes

Versions: 14

Compression:

Stored size: 942 Bytes

Contents

require "spec_helper"

describe "timeout" do
  context "in single event" do
    let(:pubnub) do
      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
    let(:envelope) { pubnub.time.value }

    [
      HTTPClient::ConnectTimeoutError,
      HTTPClient::ReceiveTimeoutError,
      HTTPClient::SendTimeoutError,
    ].each do |error_class|
      it "forms valid ErrorEnvelope on #{error_class}" do
        allow_any_instance_of(HTTPClient).to receive(:get).and_return error_class.new

        expect(envelope.is_a?(Pubnub::ErrorEnvelope)).to eq true
        expect(envelope.status[:code]).to eq 408
        expect(envelope.status[:category]).to eq Pubnub::Constants::STATUS_TIMEOUT
        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/timeout_handling_spec.rb
pubnub-4.5.0 spec/lib/events/timeout_handling_spec.rb
pubnub-4.4.0 spec/lib/events/timeout_handling_spec.rb
pubnub-4.3.0 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.7 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.6 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.5 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.4 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.3 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.2 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.1 spec/lib/events/timeout_handling_spec.rb
pubnub-4.2.0 spec/lib/events/timeout_handling_spec.rb
pubnub-4.1.6 spec/lib/events/timeout_handling_spec.rb
pubnub-4.1.5 spec/lib/events/timeout_handling_spec.rb