Sha256: 6000296b02f46ba12aa7f5459e0489dc10ff74d16303664c01a5ac7fbfa94a0a

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe Pubnub::Publish do
  around :each do |example|
    @pubnub = Pubnub::Client.new(
      publish_key: "pub-a-mock-key",
      subscribe_key: "sub-a-mock-key",
      uuid: "ruby-test-uuid-client-one",
      auth_key: "ruby-test-auth-client-one",
    )

    example.run_with_retry retry: 10
  end

  context "with specified ttl parameter" do
    it "adds it to url" do
      VCR.use_cassette("examples/publish-ttl-works", record: :once) do
        envelope = @pubnub.publish(channel: :demo, message: :whatever, ttl: 10, http_sync: true)

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

    it "ignores it when store is false" do
      VCR.use_cassette("examples/publish-ttl-works-ignore", record: :once) do
        envelope = @pubnub.publish(channel: :demo, message: :whatever, ttl: 10, store: false, http_sync: true)

        expect(envelope.is_a?(Pubnub::Envelope)).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/examples/publish_with_ttl_spec.rb
pubnub-4.5.0 spec/examples/publish_with_ttl_spec.rb
pubnub-4.4.0 spec/examples/publish_with_ttl_spec.rb
pubnub-4.3.0 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.7 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.6 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.5 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.4 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.3 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.2 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.1 spec/examples/publish_with_ttl_spec.rb
pubnub-4.2.0 spec/examples/publish_with_ttl_spec.rb
pubnub-4.1.6 spec/examples/publish_with_ttl_spec.rb
pubnub-4.1.5 spec/examples/publish_with_ttl_spec.rb